-
Notifications
You must be signed in to change notification settings - Fork 810
Fix circular import in cortex_m passes using relative imports #16376
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/16376
Note: Links to docs will display an error until the docs builds have been completed. ❌ 2 New Failures, 4 Unrelated FailuresAs of commit f776870 with merge base 39203cf ( NEW FAILURES - The following jobs have failed:
FLAKY - The following jobs failed but were likely due to flakiness present on trunk:
UNSTABLE - The following job is marked as unstable, possibly due to flakiness on trunk:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This PR needs a
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR fixes a circular import error in the cortex_m passes module by converting absolute imports to relative imports in cortex_m_pass_manager.py. The circular dependency chain (__init__.py → cortex_m_pass_manager.py → __init__.py) is broken by having cortex_m_pass_manager.py import directly from individual pass modules rather than through the package's __init__.py.
Key Changes:
- Replaced absolute imports (
from executorch.backends.cortex_m.passes import ...) with relative imports (from .activation_fusion_pass import ...) for all six pass classes - Moved import statements to maintain proper ordering (after external imports, before usage)
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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'
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'
Summary
[PLEASE REMOVE] See CONTRIBUTING.md's Pull Requests for ExecuTorch PR guidelines.
[PLEASE REMOVE] If this PR closes an issue, please add a
Fixes #<issue-id>line.[PLEASE REMOVE] If this PR introduces a fix or feature that should be the upcoming release notes, please add a "Release notes: " label. For a list of available release notes labels, check out CONTRIBUTING.md's Pull Requests.
Test plan
[PLEASE REMOVE] How did you test this PR? Please write down any manual commands you used and note down tests that you have written if applicable.