-
Notifications
You must be signed in to change notification settings - Fork 88
Strongly-typed static code generation for IntelliSense support #162
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
eff8824
Create actual types for TensorType so that they work through type ann…
abock ccad857
values.Opset: add class to cache key
abock e35b9f8
Implement strongly typed static code generation of all ops
abock 15198af
Generated opset code
abock 479c906
Generate opset 18 from onnx==1.13.0rc1
abock 48b8029
tensor.py: explicitly downcast opset to Any
abock 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 was deleted.
Oops, something went wrong.
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 |
|---|---|---|
| @@ -0,0 +1,191 @@ | ||
| # -------------------------------------------------------------------------- | ||
| # ⚠️ WARNING - AUTO-GENERATED CODE - DO NOT EDIT ⚠️ | ||
| # ⚙️ Generated by 'python -m opgen' | ||
| # -------------------------------------------------------------------------- | ||
| # Copyright (c) Microsoft Corporation. All rights reserved. | ||
| # Licensed under the MIT License. | ||
| # -------------------------------------------------------------------------- | ||
| # flake8: noqa | ||
| # mypy: disable-error-code=override | ||
| # pylint: disable=W0221,W0222,W0237,W0246,R0901 | ||
| # -------------------------------------------------------------------------- | ||
|
|
||
| from onnx.defs import onnx_opset_version | ||
|
|
||
| from onnxscript.onnx_opset._impl.opset1 import Opset1 | ||
| from onnxscript.onnx_opset._impl.opset2 import Opset2 | ||
| from onnxscript.onnx_opset._impl.opset3 import Opset3 | ||
| from onnxscript.onnx_opset._impl.opset4 import Opset4 | ||
| from onnxscript.onnx_opset._impl.opset5 import Opset5 | ||
| from onnxscript.onnx_opset._impl.opset6 import Opset6 | ||
| from onnxscript.onnx_opset._impl.opset7 import Opset7 | ||
| from onnxscript.onnx_opset._impl.opset8 import Opset8 | ||
| from onnxscript.onnx_opset._impl.opset9 import Opset9 | ||
| from onnxscript.onnx_opset._impl.opset10 import Opset10 | ||
| from onnxscript.onnx_opset._impl.opset11 import Opset11 | ||
| from onnxscript.onnx_opset._impl.opset12 import Opset12 | ||
| from onnxscript.onnx_opset._impl.opset13 import Opset13 | ||
| from onnxscript.onnx_opset._impl.opset14 import Opset14 | ||
| from onnxscript.onnx_opset._impl.opset15 import Opset15 | ||
| from onnxscript.onnx_opset._impl.opset16 import Opset16 | ||
| from onnxscript.onnx_opset._impl.opset17 import Opset17 | ||
| from onnxscript.onnx_opset._impl.opset18 import Opset18 | ||
| from onnxscript.onnx_opset._impl.opset_ai_onnx_ml1 import Opset_ai_onnx_ml1 | ||
| from onnxscript.onnx_opset._impl.opset_ai_onnx_ml2 import Opset_ai_onnx_ml2 | ||
| from onnxscript.onnx_opset._impl.opset_ai_onnx_ml3 import Opset_ai_onnx_ml3 | ||
| from onnxscript.onnx_opset._impl.opset_ai_onnx_preview_training1 import ( | ||
| Opset_ai_onnx_preview_training1, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "default_opset", | ||
| "all_opsets", | ||
| "opset1", | ||
| "opset2", | ||
| "opset3", | ||
| "opset4", | ||
| "opset5", | ||
| "opset6", | ||
| "opset7", | ||
| "opset8", | ||
| "opset9", | ||
| "opset10", | ||
| "opset11", | ||
| "opset12", | ||
| "opset13", | ||
| "opset14", | ||
| "opset15", | ||
| "opset16", | ||
| "opset17", | ||
| "opset18", | ||
| "opset_ai_onnx_ml1", | ||
| "opset_ai_onnx_ml2", | ||
| "opset_ai_onnx_ml3", | ||
| "opset_ai_onnx_preview_training1", | ||
| ] | ||
|
|
||
|
|
||
| if onnx_opset_version() < 14: | ||
| raise ImportError( | ||
| f"ONNX Script requires ONNX opset >= 14 but {onnx_opset_version()} is detected." | ||
| ) | ||
|
|
||
|
|
||
| opset1 = Opset1() | ||
| opset2 = Opset2() | ||
| opset3 = Opset3() | ||
| opset4 = Opset4() | ||
| opset5 = Opset5() | ||
| opset6 = Opset6() | ||
| opset7 = Opset7() | ||
| opset8 = Opset8() | ||
| opset9 = Opset9() | ||
| opset10 = Opset10() | ||
| opset11 = Opset11() | ||
| opset12 = Opset12() | ||
| opset13 = Opset13() | ||
| opset14 = Opset14() | ||
| opset15 = Opset15() | ||
| opset16 = Opset16() | ||
| opset17 = Opset17() | ||
| opset18 = Opset18() | ||
| opset_ai_onnx_ml1 = Opset_ai_onnx_ml1() | ||
| opset_ai_onnx_ml2 = Opset_ai_onnx_ml2() | ||
| opset_ai_onnx_ml3 = Opset_ai_onnx_ml3() | ||
| opset_ai_onnx_preview_training1 = Opset_ai_onnx_preview_training1() | ||
| all_opsets = { | ||
| ( | ||
| "", | ||
| 1, | ||
| ): opset1, | ||
| ( | ||
| "", | ||
| 2, | ||
| ): opset2, | ||
| ( | ||
| "", | ||
| 3, | ||
| ): opset3, | ||
| ( | ||
| "", | ||
| 4, | ||
| ): opset4, | ||
| ( | ||
| "", | ||
| 5, | ||
| ): opset5, | ||
| ( | ||
| "", | ||
| 6, | ||
| ): opset6, | ||
| ( | ||
| "", | ||
| 7, | ||
| ): opset7, | ||
| ( | ||
| "", | ||
| 8, | ||
| ): opset8, | ||
| ( | ||
| "", | ||
| 9, | ||
| ): opset9, | ||
| ( | ||
| "", | ||
| 10, | ||
| ): opset10, | ||
| ( | ||
| "", | ||
| 11, | ||
| ): opset11, | ||
| ( | ||
| "", | ||
| 12, | ||
| ): opset12, | ||
| ( | ||
| "", | ||
| 13, | ||
| ): opset13, | ||
| ( | ||
| "", | ||
| 14, | ||
| ): opset14, | ||
| ( | ||
| "", | ||
| 15, | ||
| ): opset15, | ||
| ( | ||
| "", | ||
| 16, | ||
| ): opset16, | ||
| ( | ||
| "", | ||
| 17, | ||
| ): opset17, | ||
| ( | ||
| "", | ||
| 18, | ||
| ): opset18, | ||
| ( | ||
| "ai.onnx.ml", | ||
| 1, | ||
| ): opset_ai_onnx_ml1, | ||
| ( | ||
| "ai.onnx.ml", | ||
| 2, | ||
| ): opset_ai_onnx_ml2, | ||
| ( | ||
| "ai.onnx.ml", | ||
| 3, | ||
| ): opset_ai_onnx_ml3, | ||
| ( | ||
| "ai.onnx.preview.training", | ||
| 1, | ||
| ): opset_ai_onnx_preview_training1, | ||
| } | ||
| default_opset: Opset14 = all_opsets[ | ||
| ( | ||
| "", | ||
| onnx_opset_version(), | ||
| ) | ||
| ] # type: ignore | ||
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.
Uh oh!
There was an error while loading. Please reload this page.