I wanted to do something like this:
out1 = net1(input) out2 = net2(out1) other_out = net3(out1)
I want to update net1 with the weighted sum of gradient from out2 i.e. out2.backward() and other_out. So the similar implementation in torch7 would be:
dnet2 = net2:backward(...some argument....) net1:backward(input, l1* dnet2 + l2*other_out)
where l1 and l2 are some constants. The dimensions of dnet2 and other_out are same.
How should I do something like this in pytorch? @smth