I assume the gradients for out1 and out2 are not calculated, as they both reference to out3.
If you add a clone() operation to out2 = out1.clone() and out3, they will be treated differently.
Probably related to this post.
1 Like