Revert "Fix Avoid DDE in item numel check (#164934)"

This reverts commit a9a9a3438a374f96a308b707a1718036aaec790d.

Reverted https://github.com/pytorch/pytorch/pull/164934 on behalf of https://github.com/pytorch-auto-revert due to Reverted automatically by pytorch's autorevert, to avoid this behaviour add the tag autorevert: disable ([comment](https://github.com/pytorch/pytorch/pull/164934#issuecomment-3384390621))
This commit is contained in:
PyTorch MergeBot
2025-10-09 06:57:03 +00:00
parent f231be25c6
commit 5209c8ce07
2 changed files with 1 additions and 20 deletions

View File

@ -4222,21 +4222,6 @@ def forward(self, arg0_1: "i64[1][1]cpu", arg1_1: "Sym(u1)", arg2_1: "i64[u1][1]
eager_result = func(x, torch.tensor([5]))
self.assertEqual(cnt.frame_count, 2)
@torch._dynamo.config.patch("capture_scalar_outputs", True)
def test_unbacked_item(self):
def func():
_x_ms = torch.tensor([True, False], dtype=torch.int64)
_mask_ms = torch.zeros_like(_x_ms, dtype=torch.bool)
_mask_ms[:1] = True
var_node_2 = torch.masked_select(_x_ms, _mask_ms)
var_node_0 = var_node_2.item()
return var_node_0
result_original = func()
compiled_program = torch.compile(func, fullgraph=True, dynamic=True)
result_compiled = compiled_program()
self.assertEqual(result_original, result_compiled)
instantiate_parametrized_tests(TestUnbacked)