It belongs to tensor (if present)?
To get the model’s parameter’s grad, you could loop through for name, p in model.named_parameters() and use p.grad for each.
The .data should probably be avoided.
Best regards
Thomas