InnovArul:

for i in range(100):
    rot_mat = rot_mat.detach().clone()
    rot_mat.requires_grad=True



Hey there! Thanks for the reply. Your code suggestion does indeed solve the retain graph problem. I’m still attempting to track back the gradients to the intiial x_rot and z_rot parameters.
PyTorch seems to have a lot of side-effects and things going on in the background. I’ll need to be careful. It would be nice to get a bit more explicit and hunt down exactly what is going on.