Revert "[Export] Support retraceability test on existing cases (#115402)"
This reverts commit b0c7dd47cdb8d17bbfd0ab2963b1afb908dab716.
Reverted https://github.com/pytorch/pytorch/pull/115402 on behalf of https://github.com/atalman due to OSSCI oncall, broke CI tests ([comment](https://github.com/pytorch/pytorch/pull/115402#issuecomment-1853864075))
diff --git a/test/export/test_export.py b/test/export/test_export.py
index efde491..0afd7dc 100644
--- a/test/export/test_export.py
+++ b/test/export/test_export.py
@@ -131,7 +131,6 @@
inp = ([torch.ones(1, 3)], torch.ones(1, 3))
self._test_export_same_as_eager(f, inp)
- @testing.expectedFailureRetraceability
def test_external_call_non_strict_real_tensor(self):
class ExternalMethod:
def add(self, x):
@@ -150,7 +149,6 @@
ep = export(f, args, strict=False)
self.assertEqual(ep(*args), f(*args))
- @testing.expectedFailureRetraceability
def test_basic_non_strict_real_tensor(self):
class Basic(torch.nn.Module):
def __init__(self):
@@ -165,7 +163,6 @@
ep = export(f, args, strict=False)
self.assertEqual(ep(*args), f(*args))
- @testing.expectedFailureRetraceability
def test_basic_non_strict_fake_tensor(self):
class Basic(torch.nn.Module):
def __init__(self):
@@ -270,7 +267,6 @@
with self.assertRaisesRegex(torchdynamo.exc.UserError, "Expected tensor as input to dynamic_dim"):
constraints = [dynamic_dim(inp_for_g, 0)]
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_map(self):
def list_tensor_map(xs, y, z):
@@ -282,7 +278,6 @@
inps = (torch.ones(6, 4), torch.tensor(5), torch.tensor(4))
self._test_export_same_as_eager(list_tensor_map, inps)
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_export_func_with_kwargs(self):
def kw_func(arg1, arg2, kw1, kw2):
@@ -292,7 +287,6 @@
kwargs = {"kw1": torch.ones(1, 1), "kw2": torch.ones(6, 4)}
self._test_export_same_as_eager(kw_func, args, kwargs)
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_export_func_with_pytree_kwargs(self):
def kw_func(arg1, arg2, a, b):
@@ -302,7 +296,6 @@
kwargs = {"a": {"kw1": torch.ones(2, 3), "kw2": torch.ones(3, 4)}, "b": [torch.ones(2, 3), torch.ones(3, 4)]}
self._test_export_same_as_eager(kw_func, args, kwargs)
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_export_func_with_default_kwargs(self):
def kw_func(arg1, arg2, a, b=1):
@@ -328,7 +321,6 @@
args = (torch.ones(2, 3), torch.ones(3, 4), torch.ones(2, 3), torch.ones(3, 4))
self._test_export_same_as_eager(kw_func, args)
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_export_func_with_keyword_only_args(self):
def kw_func(arg1, arg2, *args, kw1, kw2):
@@ -338,7 +330,6 @@
kwargs = {"kw1": torch.ones(2, 3), "kw2": torch.ones(3, 4)}
self._test_export_same_as_eager(kw_func, args, kwargs)
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_export_func_with_var_keyword_args(self):
def kw_func(arg1, arg2, *args, kw1, kw2, **kwargs):
@@ -348,7 +339,6 @@
kwargs = {"kw1": torch.ones(2, 3), "kw2": torch.ones(3, 4), "kw3": torch.ones(2, 3), "kw4": torch.ones(3, 4)}
self._test_export_same_as_eager(kw_func, args, kwargs)
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_export_func_with_var_keyword_pytree_args(self):
def kw_func(arg1, arg2, *args, kw1, kw2, **kwargs):
@@ -1421,7 +1411,6 @@
exp_source_fns = [["cond", "cos"], ["cond", "sin"]]
self.assertEqual(actual_source_fns, exp_source_fns)
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_lifted_constants(self) -> None:
def f(x):
@@ -1546,7 +1535,6 @@
self.assertTrue(torch.allclose(core_aten_ep(*inp), m(*inp)))
self.assertEqual(id(state_dict), id(ep.state_dict))
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_export_decomps_dynamic(self):
class M(torch.nn.Module):
@@ -1583,7 +1571,6 @@
inp = torch.randn(2)
self.assertTrue(torch.allclose(ep(inp), torch.nonzero(inp)))
- @testing.expectedFailureRetraceability
@testing.expectedFailureNonStrict
def test_redundant_asserts(self):
def f(x):
diff --git a/test/export/test_retraceability.py b/test/export/test_retraceability.py
deleted file mode 100644
index 53e95a7..0000000
--- a/test/export/test_retraceability.py
+++ /dev/null
@@ -1,47 +0,0 @@
-# Owner(s): ["module: dynamo"]
-
-import test_export
-import testing
-from torch.export import export
-
-test_classes = {}
-
-
-def mocked_retraceability_export(*args, **kwargs):
- ep = export(*args, **kwargs)
- ep = export(ep, *(args[1:]), **kwargs)
- return ep
-
-
-def make_dynamic_cls(cls):
- suffix = "_retraceability"
-
- cls_prefix = "RetraceExport"
-
- test_class = testing.make_test_cls_with_mocked_export(
- cls,
- cls_prefix,
- suffix,
- mocked_retraceability_export,
- xfail_prop="_expected_failure_retrace",
- )
-
- test_classes[test_class.__name__] = test_class
- # REMOVING THIS LINE WILL STOP TESTS FROM RUNNING
- globals()[test_class.__name__] = test_class
- test_class.__module__ = __name__
- return test_class
-
-
-tests = [
- test_export.TestDynamismExpression,
- test_export.TestExport,
-]
-for test in tests:
- make_dynamic_cls(test)
-del test
-
-if __name__ == "__main__":
- from torch._dynamo.test_case import run_tests
-
- run_tests()
diff --git a/test/export/testing.py b/test/export/testing.py
index 460a7e5..370801e 100644
--- a/test/export/testing.py
+++ b/test/export/testing.py
@@ -41,9 +41,3 @@
def expectedFailureNonStrict(fn):
fn._expected_failure_non_strict = True
return fn
-
-
-# Controls tests generated in test/export/test_retraceability.py
-def expectedFailureRetraceability(fn):
- fn._expected_failure_retrace = True
- return fn