Hi @albanD, thanks for the reply.
The reason of using .data is because if I don’t use it, I realize the the parameter of netB won’t be updated.
Both netA and netB have learnable parameters. The idea is that when I’m doing a forward pass on netB, its parameter is a composition of netB's original parameter plus a gradient provided by netA. So when I’m doing backprop, I’m hoping that the gradient will update both netB and netA as the provided gradient should be part of the computational graph.