Hi,
If you leave it as your first example, when you backprop the F.conv2d, no gradient get accumulated since no input is a leaf.
But then you backprop through the computation of self.weight1 and that will add gradients to self.conv.weight.
In parallel, you backprop through self.conv which will also accumulate gradients into self.conv.weight.
So in the end, the gradients in self.conv.weight is just the sum of the gradients of all the places where it is used.