Add check for same dtype in tensordot implementation (#98938)
Fixes #77517
I believe[ the first bullet point in this comment](https://github.com/pytorch/pytorch/issues/77517#issuecomment-1129233539) from the linked issue is no longer a concern, but please let me know if I'm incorrect here.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/98938
Approved by: https://github.com/lezcano