How to write in_grad if I have multiple outputs in Customized operator


#1

Hello, does anyone have any idea how I can write in_grad if I have out_data[0] and out_data[1] and in_data[0], in_data[1]?

I need the in_grad for four pairs, namely (in_data[0], out_data[0]), … , (in_data[1], out_data[1]). What should I input for in_grad[0] and in_grad[1]?

Thanks a lot!


#2

Just keep in mind that in_data[0,1,2,3…], out_data[0, 1, 2, 3…], in_grad[0, 1, 2, 3…], out_grad[0, 1, 2, 3…] are always aligned with same order.


#4

thanks, may I ask another question? As far as I can see, in_grad always has the same shapes as in_data. But till now I have’t seen any example how to use out_grad. Is it also the same size of out_data? How is this used in backward propagation? Many thanks in advance!