Mass_and_v is not an nn.Module class and also uses numpy arrays internally, which Autograd won’t be able to track.
Derive Mass_and_v from nn.Module and register the parameters as nn.Parameter in its __init__.