Fix some tensor operators to return `NotImplemented` for invalid inputs (#58216)
Summary:
Same as https://github.com/pytorch/pytorch/issues/57934. (cc/ albanD)
Pull Request resolved: https://github.com/pytorch/pytorch/pull/58216
Reviewed By: ailzhang
Differential Revision: D28494886
Pulled By: albanD
fbshipit-source-id: 380205867ee1cde90e1c6fcfe2a31749e1243530