Ok,
So adding the requires grad on the data does fix the issue that the backbone would not be learning.
For the res2 freezing I’m not sure what you mean here.
The checkpoint has this behavior that it make all outputs require gradient, because it does not know which elements will actually require it yet.
Note that in the final computation during the backward, that gradient (should) will be discarded and not used, so the frozen part should remain frozen. Even though you don’t see it in the forward pass.
Adding the detach() after the checkpoint will work as well