Skip to content

Commit f776870

Browse files
author
Github Executorch
committed
Fix circular import in cortex_m passes using relative imports
Changed cortex_m_pass_manager.py to use relative imports (from .activation_fusion_pass) instead of absolute imports (from executorch.backends.cortex_m.passes) for intra-package references. This breaks the circular import chain: __init__.py → cortex_m_pass_manager.py → __init__.py Resolves: ImportError: cannot import name 'ActivationFusionPass' from partially initialized module 'executorch.backends.cortex_m.passes'
1 parent 39203cf commit f776870

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

backends/cortex_m/passes/cortex_m_pass_manager.py

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,6 @@
1010
FoldAndAnnotateQParamsPass,
1111
ScalarsToAttributePass,
1212
)
13-
from executorch.backends.cortex_m.passes import (
14-
ActivationFusionPass,
15-
ClampHardswishPass,
16-
ConvertToCortexMPass,
17-
DecomposeHardswishPass,
18-
QuantizedOpFusionPass,
19-
ReplaceQuantNodesPass,
20-
)
2113
from executorch.backends.transforms.replace_scalar_with_tensor import (
2214
ReplaceScalarWithTensorArgPass,
2315
)
@@ -26,6 +18,13 @@
2618
from executorch.exir.program._program import _transform
2719
from torch.export import ExportedProgram
2820

21+
from .activation_fusion_pass import ActivationFusionPass
22+
from .clamp_hardswish_pass import ClampHardswishPass
23+
from .convert_to_cortex_m_pass import ConvertToCortexMPass
24+
from .decompose_hardswish_pass import DecomposeHardswishPass
25+
from .quantized_op_fusion_pass import QuantizedOpFusionPass
26+
from .replace_quant_nodes_pass import ReplaceQuantNodesPass
27+
2928

3029
class CortexMPassManager(PassManager):
3130

backends/cortex_m/quantizer/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,3 @@
1616
SOFTMAX_OUTPUT_FIXED_QSPEC,
1717
SOFTMAX_PER_TENSOR_CONFIG,
1818
)
19-
from .quantizer import CortexMQuantizer, SharedQspecQuantizer # noqa

0 commit comments

Comments
 (0)