-
Notifications
You must be signed in to change notification settings - Fork 54
Merge Main (PR #204) and Complete Opset Versioning Implementation #216
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
5ff3838
feat: Implement namespace-based CustomOp registration system
tafk7 20e7ecc
Remove unused entrypoint system
tafk7 8080f57
Removed unnecessary __all__ exports
tafk7 3fd7d11
refactor: Add lazy-loading cache and thread safety to CustomOp registry
tafk7 3cf6fe6
refactor: Replace is_finn_op with registry-based is_custom_op
tafk7 b329fcb
feat: Add add_op_to_domain and get_ops_in_domain registry functions
tafk7 55e081c
Remove unnecessary check for class type in registry.py
tafk7 83db58d
Merge pull request #204 from tafk7/feature/namespace-based-customop-r…
maltanar 787a47e
refactor: implement namespace-based opset versioning system
tafk7 f8a07af
refactor: remove explicit op_version attributes in favor of class nam…
tafk7 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,29 +1,6 @@ | ||
| # Importing registers CustomOps in qonnx.custom_op.channels_last domain | ||
| from qonnx.custom_op.channels_last.batch_normalization import BatchNormalization | ||
| from qonnx.custom_op.channels_last.conv import Conv | ||
| from qonnx.custom_op.channels_last.max_pool import MaxPool | ||
|
|
||
| # channels-last ops are defined by the underlying ONNX standard op | ||
| # thus, we can define them for any version of the original op | ||
| # so we emulate a custom op dictionary that mimics the support for any | ||
| # {ChannelsLastOp}_vX instead of hardcoding what versions are supported | ||
|
|
||
|
|
||
| class ChannelsLastCustomOpDict(dict): | ||
| def __init__(self): | ||
| self._custom_ops = {"Conv": Conv, "MaxPool": MaxPool, "BatchNormalization": BatchNormalization} | ||
|
|
||
| def __getitem__(self, key): | ||
| base_key = key.split("_v")[0] # Extract base key (e.g., Conv from Conv_v13) | ||
| if base_key in self._custom_ops: | ||
| return self._custom_ops[base_key] | ||
| raise KeyError(f"Channels-last CustomOp '{key}' not found.") | ||
|
|
||
| def __contains__(self, key): | ||
| base_key = key.split("_v")[0] | ||
| return base_key in self._custom_ops | ||
|
|
||
| def keys(self): | ||
| return self._custom_ops.keys() | ||
|
|
||
|
|
||
| custom_op = ChannelsLastCustomOpDict() | ||
| __all__ = ["Conv", "MaxPool", "BatchNormalization"] | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
this does not respect the semantics (channels-last ops being implicitly defined for any version of the standard op) in the deleted code, instead all channels-last ops will now be registered as v1, meaning that they will instantiate ai.onnx v1 standard nodes under the hood. can you address this?
if this is tricky to fix in the new system, one band-aid we can apply is instead registering these channels-last ops as v11 which is the current preferred ONNX opset version. in this way they would do something slightly more reasonable.