From 2524635cbe48a307ccf830f1529635752aa498e6 Mon Sep 17 00:00:00 2001 From: William Wen Date: Wed, 15 May 2024 11:56:22 -0700 Subject: [PATCH] [dynamo] fix https://github.com/pytorch/pytorch/issues/93624 (#125945) Fixes https://github.com/pytorch/pytorch/issues/93624 but also requires https://github.com/jcmgray/autoray/issues/20 to be fixed. Pull Request resolved: https://github.com/pytorch/pytorch/pull/125945 Approved by: https://github.com/jansel ghstack dependencies: #125882, #125943 --- ...test_resnet18_per_sample_grads_mechanism_functional_call_cpu | 0 ...test_resnet18_per_sample_grads_mechanism_make_functional_cpu | 0 .../TestFXGraphMatcherModels.test_mobilenet_v2_qat | 0 torch/_dynamo/variables/builtin.py | 2 +- 4 files changed, 1 insertion(+), 1 deletion(-) delete mode 100644 test/dynamo_expected_failures/TestExamplesCorrectnessCPU.test_resnet18_per_sample_grads_mechanism_functional_call_cpu delete mode 100644 test/dynamo_expected_failures/TestExamplesCorrectnessCPU.test_resnet18_per_sample_grads_mechanism_make_functional_cpu delete mode 100644 test/dynamo_expected_failures/TestFXGraphMatcherModels.test_mobilenet_v2_qat diff --git a/test/dynamo_expected_failures/TestExamplesCorrectnessCPU.test_resnet18_per_sample_grads_mechanism_functional_call_cpu b/test/dynamo_expected_failures/TestExamplesCorrectnessCPU.test_resnet18_per_sample_grads_mechanism_functional_call_cpu deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/dynamo_expected_failures/TestExamplesCorrectnessCPU.test_resnet18_per_sample_grads_mechanism_make_functional_cpu b/test/dynamo_expected_failures/TestExamplesCorrectnessCPU.test_resnet18_per_sample_grads_mechanism_make_functional_cpu deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/test/dynamo_expected_failures/TestFXGraphMatcherModels.test_mobilenet_v2_qat b/test/dynamo_expected_failures/TestFXGraphMatcherModels.test_mobilenet_v2_qat deleted file mode 100644 index e69de29bb2d1d..0000000000000 diff --git a/torch/_dynamo/variables/builtin.py b/torch/_dynamo/variables/builtin.py index 822d87b7a2120..118e5a4addf98 100644 --- a/torch/_dynamo/variables/builtin.py +++ b/torch/_dynamo/variables/builtin.py @@ -1577,7 +1577,7 @@ def call_getattr( ) and trace_rules.is_aten_op_or_tensor_method(member): return TorchInGraphFunctionVariable(member, **options) elif isinstance(obj, (PythonModuleVariable, DummyModule)): - if obj.is_torch: + if obj.is_torch or name not in obj.value.__dict__: member = getattr(obj.value, name) else: member = obj.value.__dict__[name]