Change ShardedTensor torch_function to be a classmethod. (#74273)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/74273
As per discussion in https://github.com/pytorch/pytorch/issues/63767,
torch_function should be a classmethod and instance method based
implementations would be deprecated soon.
As a result, making this a classmethod and using the suggestion in
https://github.com/pytorch/pytorch/issues/63767 to find the ShardedTensor
instance in the args/kwargs.
ghstack-source-id: 151463383
Test Plan: waitforbuildbot
Reviewed By: wanchaol
Differential Revision: D34913799
fbshipit-source-id: c2f95ace861b118ea539215188d8723316cbb066
(cherry picked from commit 180666430e13df6ff1c23c633625948b1b13299b)