Revert "Fix double dispatch to Python for detach (#163671)"

This reverts commit c32118dc3e50505fd285e6e448a90883fce11535.

Reverted https://github.com/pytorch/pytorch/pull/163671 on behalf of https://github.com/izaitsevfb due to breaks export tests ([comment](https://github.com/pytorch/pytorch/pull/163671#issuecomment-3379281422))
This commit is contained in:
PyTorch MergeBot
2025-10-08 01:46:43 +00:00
parent c813617c53
commit 97463d4cf3
10 changed files with 90 additions and 49 deletions

View File

@ -850,7 +850,7 @@ $1: f32[] = torch._ops.my_lib.weird.default(['None', '$0'])""",
lambda: A(torch.zeros(1)).detach(),
)
def test_detach_appears_once_when_called_once(self) -> None:
def test_detach_appears_twice_when_called_once(self) -> None:
with capture_logs() as logs:
x = LoggingTensor(torch.tensor([3.0]), requires_grad=True)
log_input("x", x)
@ -863,7 +863,8 @@ $1: f32[] = torch._ops.my_lib.weird.default(['None', '$0'])""",
"\n".join(logs),
"""\
$0: f32[1] = input('x')
$1: f32[1] = torch._ops.aten.detach.default($0)""",
$1: f32[1] = torch._ops.aten.detach.default($0)
$2: f32[1] = torch._ops.aten.detach.default($1)""",
)
def test_storage(self) -> None: