Update sdp_utils to check gradmode and subclassed tensors (#92323)
# Summary
Fix up the grad check test to check for subclassed tensors and gradmode
Pull Request resolved: https://github.com/pytorch/pytorch/pull/92323
Approved by: https://github.com/soulitzer