Rewrite functional.tensordot to be TorchScript-able (#53672)
Summary:
Fixes https://github.com/pytorch/pytorch/issues/53487
Pull Request resolved: https://github.com/pytorch/pytorch/pull/53672
Reviewed By: VitalyFedyunin
Differential Revision: D26934392
Pulled By: gmagogsfm
fbshipit-source-id: f842af340e4be723bf90b903793b0221af158ca7