Change default torch_function behavior to be disabled when torch_dispatch is defined (take 2) (#120632)

This does not introduce a new test but is tested by checking that all the classes we already have still behave as before now that they don't explicitly disable torch_function.

Pull Request resolved: https://github.com/pytorch/pytorch/pull/120632
Approved by: https://github.com/ezyang
This commit is contained in:
albanD
2024-03-09 01:08:32 +00:00
committed by PyTorch MergeBot
parent ca9678405a
commit 6791b0c09e
15 changed files with 49 additions and 48 deletions

View File

@ -235,8 +235,6 @@ class TestSubclass(TestCase):
def __init__(self, t) -> None:
self.tensor: torch.Tensor = t
__torch_function__ = torch._C._disabled_torch_function_impl
@classmethod
def __torch_dispatch__(cls, func, types, args=(), kwargs=None):