Fix tensordot allowing negative dims (#31954)
Summary:
fixes https://github.com/pytorch/pytorch/issues/31926
Pull Request resolved: https://github.com/pytorch/pytorch/pull/31954
Differential Revision: D19331847
Pulled By: zou3519
fbshipit-source-id: e30dd9517917c056a52be7d16f23247fe28f4e28