I had a question.  In general, what’s the best way to test if autograd works with certain external packages?  That is, the gradient is being properly calculated…
In my case I am coding a GAN - the generator outputs some values but before I pass them into the discriminator, I have to perform some transformations (this is odometry data).  Those transformations involve this package, mathutils. Here’s an example of a function I apply to the output of the generator (Note that R and T and rotation and translation values that determine a 6dof pose)

def to_rotation_matrix(R, T):
    if isinstance(R, torch.Tensor):
        R = quat2mat(R)
        T = tvector2mat(T)
        RT = torch.mm(T, R)
    else:
        R = R.to_matrix()
        R.resize_4x4()
        T = mathutils.Matrix.Translation(T)
        RT = T@R
    return RT

I want to ensure that using these sorts of custome functions isn’t going to mess with the autograd and that all the gradients will be taken correctly. I’m trying to find the best way to test whether or not autograd is correctly calculating the gradients, i.e., that it’s account for the transformations and rotations that I am doing.  Is there a good way/simple way to test this?  Thanks