Update fx proxy to use classmethod for __torch_function__ (#64842)
authoralbanD <desmaison.alban@gmail.com>
Fri, 17 Sep 2021 15:01:33 +0000 (08:01 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 17 Sep 2021 15:32:51 +0000 (08:32 -0700)
commit1ed9c33d081c9b8cfb03e021450c7bf52495db1d
tree7fd22fee7cfe214475da9fa9af0e52d624871066
parent473e55d5b21c7cd2e02b43281d039329d6eba926
Update fx proxy to use classmethod for __torch_function__ (#64842)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/64842

Change the `__torch_function__` to follow best guidelines of using classmethods.
I am not sure how to handle the case where multiple tracer objects are given as input but given that before we were getting an arbitrary tracer from there based on the "self" that was arbitrarily chosen by the torch_function caller, the new implementation is not worst?
Let me know what you think!

Test Plan: Imported from OSS

Reviewed By: heitorschueroff

Differential Revision: D30991423

Pulled By: albanD

fbshipit-source-id: d28940df230b543952b278a0eb2d61cf7ae123ce
torch/fx/proxy.py