HI,
Hi, the problem is that you use .data which breaks that history and prevent gradient computation.
In particular, if netB does not have any learnable parameters, you should remove them (del netB.some_mod.weight for example) and then fill it in with the value computed: netB.some_mod.weight = lr * grad[i]