已合并
eager_init_variable_builder_builtin #41622
cuiduo创建于 7月14日
eager_init_variable_builder_builtin #41622
已合并
共 2 个文件变更+3-4
| @@ -23,7 +23,6 @@ from torch_npu._inductor.codegen.wrapper import ( | |||
| 23 | from torch.testing._internal.common_utils import run_tests | 23 | from torch.testing._internal.common_utils import run_tests |
| 24 | 24 | ||
| 25 | import torch_npu | 25 | import torch_npu |
| 26 | -import torch_npu._inductor | ||
| 27 | from torch_npu.testing.common_utils import SupportedDevices | 26 | from torch_npu.testing.common_utils import SupportedDevices |
| 28 | 27 | ||
| 29 | from testutils import TestUtils | 28 | from testutils import TestUtils |
| @@ -212,11 +212,11 @@ def patch_inductor_wrapper(): | |||
| 212 | 212 | ||
| 213 | 213 | ||
| 214 | def patch_dynamo_optimize(): | 214 | def patch_dynamo_optimize(): |
| 215 | - from torch._dynamo import optimize | ||
| 216 | from torch_npu.dynamo import _get_global_npu_backend | 215 | from torch_npu.dynamo import _get_global_npu_backend |
| 217 | - src_optimize = optimize | 216 | + src_optimize = torch._dynamo.optimize |
| 218 | 217 | ||
| 219 | def npu_optimize(*args, **kwargs): | 218 | def npu_optimize(*args, **kwargs): |
| 219 | + add_dynamo_methods_init() | ||
| 220 | backend = None | 220 | backend = None |
| 221 | if "backend" in kwargs: | 221 | if "backend" in kwargs: |
| 222 | backend = kwargs["backend"] | 222 | backend = kwargs["backend"] |
| @@ -436,7 +436,6 @@ def add_dynamo_methods_init(): | |||
| 436 | patch_SkipFunctionVariable() | 436 | patch_SkipFunctionVariable() |
| 437 | patch_TensorVariable_call_method() | 437 | patch_TensorVariable_call_method() |
| 438 | patch_stream_event_variable_python_type() | 438 | patch_stream_event_variable_python_type() |
| 439 | - patch_builtin_variable() | ||
| 440 | patch_npu_stream_context() | 439 | patch_npu_stream_context() |
| 441 | patch_npu_current_stream() | 440 | patch_npu_current_stream() |
| 442 | patch_user_defined_class_variable() | 441 | patch_user_defined_class_variable() |
| @@ -444,4 +443,5 @@ def add_dynamo_methods_init(): | |||
| 444 | 443 | ||
| 445 | def add_dynamo_methods(): | 444 | def add_dynamo_methods(): |
| 446 | patch_dynamo_optimize() | 445 | patch_dynamo_optimize() |
| 446 | + patch_builtin_variable() | ||
| 447 | patch_inductor_wrapper() | 447 | patch_inductor_wrapper() |