onnxscript 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (176) hide show
  1. onnxscript/__init__.py +131 -0
  2. onnxscript/_framework_apis/__init__.py +3 -0
  3. onnxscript/_framework_apis/torch_2_5.py +117 -0
  4. onnxscript/_framework_apis/torch_2_6.py +45 -0
  5. onnxscript/_internal/__init__.py +0 -0
  6. onnxscript/_internal/analysis.py +229 -0
  7. onnxscript/_internal/ast_utils.py +64 -0
  8. onnxscript/_internal/autocast.py +250 -0
  9. onnxscript/_internal/deprecation.py +78 -0
  10. onnxscript/_internal/param_manipulation.py +148 -0
  11. onnxscript/_internal/runtime_typing.py +43 -0
  12. onnxscript/_internal/utils.py +99 -0
  13. onnxscript/_internal/version_utils.py +118 -0
  14. onnxscript/_legacy_ir/__init__.py +341 -0
  15. onnxscript/_legacy_ir/visitor.py +937 -0
  16. onnxscript/_thirdparty/asciichartpy.py +313 -0
  17. onnxscript/backend/__init__.py +2 -0
  18. onnxscript/backend/onnx_backend.py +303 -0
  19. onnxscript/backend/onnx_export.py +885 -0
  20. onnxscript/converter.py +1470 -0
  21. onnxscript/evaluator.py +619 -0
  22. onnxscript/function_libs/tools/torch_lib/deduce_type_constraints.py +403 -0
  23. onnxscript/function_libs/tools/torch_lib/generate_aten_signatures.py +333 -0
  24. onnxscript/function_libs/tools/torch_lib/generate_prims_signatures.py +331 -0
  25. onnxscript/function_libs/torch_lib/__init__.py +12 -0
  26. onnxscript/function_libs/torch_lib/_constants.py +5 -0
  27. onnxscript/function_libs/torch_lib/_flags.py +58 -0
  28. onnxscript/function_libs/torch_lib/graph_building/__init__.py +56 -0
  29. onnxscript/function_libs/torch_lib/graph_building/_graph_building_ir.py +723 -0
  30. onnxscript/function_libs/torch_lib/graph_building/_graph_building_torch.py +1125 -0
  31. onnxscript/function_libs/torch_lib/ops/__init__.py +27 -0
  32. onnxscript/function_libs/torch_lib/ops/common.py +80 -0
  33. onnxscript/function_libs/torch_lib/ops/core.py +8935 -0
  34. onnxscript/function_libs/torch_lib/ops/fft.py +385 -0
  35. onnxscript/function_libs/torch_lib/ops/linalg.py +399 -0
  36. onnxscript/function_libs/torch_lib/ops/nested.py +25 -0
  37. onnxscript/function_libs/torch_lib/ops/nn.py +2713 -0
  38. onnxscript/function_libs/torch_lib/ops/prims.py +850 -0
  39. onnxscript/function_libs/torch_lib/ops/quantized_decomposed.py +63 -0
  40. onnxscript/function_libs/torch_lib/ops/sparse.py +23 -0
  41. onnxscript/function_libs/torch_lib/ops/special.py +387 -0
  42. onnxscript/function_libs/torch_lib/ops/vision.py +25 -0
  43. onnxscript/function_libs/torch_lib/registration.py +151 -0
  44. onnxscript/function_libs/torch_lib/tensor_typing.py +74 -0
  45. onnxscript/ir/__init__.py +153 -0
  46. onnxscript/ir/_convenience.py +447 -0
  47. onnxscript/ir/_core.py +3119 -0
  48. onnxscript/ir/_display.py +49 -0
  49. onnxscript/ir/_enums.py +163 -0
  50. onnxscript/ir/_graph_comparison.py +23 -0
  51. onnxscript/ir/_io.py +97 -0
  52. onnxscript/ir/_linked_list.py +276 -0
  53. onnxscript/ir/_metadata.py +44 -0
  54. onnxscript/ir/_name_authority.py +72 -0
  55. onnxscript/ir/_polyfill.py +25 -0
  56. onnxscript/ir/_protocols.py +598 -0
  57. onnxscript/ir/_schemas.py +548 -0
  58. onnxscript/ir/_tape.py +120 -0
  59. onnxscript/ir/_type_casting.py +106 -0
  60. onnxscript/ir/convenience.py +32 -0
  61. onnxscript/ir/external_data.py +396 -0
  62. onnxscript/ir/passes/__init__.py +33 -0
  63. onnxscript/ir/passes/_pass_infra.py +172 -0
  64. onnxscript/ir/serde.py +1620 -0
  65. onnxscript/ir/tensor_adapters.py +122 -0
  66. onnxscript/ir/traversal.py +82 -0
  67. onnxscript/irbuilder.py +542 -0
  68. onnxscript/main.py +167 -0
  69. onnxscript/onnx_opset/__init__.py +232 -0
  70. onnxscript/onnx_opset/_impl/opset1.py +4100 -0
  71. onnxscript/onnx_opset/_impl/opset10.py +1227 -0
  72. onnxscript/onnx_opset/_impl/opset11.py +4013 -0
  73. onnxscript/onnx_opset/_impl/opset12.py +1078 -0
  74. onnxscript/onnx_opset/_impl/opset13.py +3924 -0
  75. onnxscript/onnx_opset/_impl/opset14.py +999 -0
  76. onnxscript/onnx_opset/_impl/opset15.py +604 -0
  77. onnxscript/onnx_opset/_impl/opset16.py +1255 -0
  78. onnxscript/onnx_opset/_impl/opset17.py +561 -0
  79. onnxscript/onnx_opset/_impl/opset18.py +1803 -0
  80. onnxscript/onnx_opset/_impl/opset19.py +1942 -0
  81. onnxscript/onnx_opset/_impl/opset2.py +218 -0
  82. onnxscript/onnx_opset/_impl/opset20.py +675 -0
  83. onnxscript/onnx_opset/_impl/opset21.py +1976 -0
  84. onnxscript/onnx_opset/_impl/opset22.py +2588 -0
  85. onnxscript/onnx_opset/_impl/opset3.py +199 -0
  86. onnxscript/onnx_opset/_impl/opset4.py +77 -0
  87. onnxscript/onnx_opset/_impl/opset5.py +84 -0
  88. onnxscript/onnx_opset/_impl/opset6.py +944 -0
  89. onnxscript/onnx_opset/_impl/opset7.py +1243 -0
  90. onnxscript/onnx_opset/_impl/opset8.py +444 -0
  91. onnxscript/onnx_opset/_impl/opset9.py +1485 -0
  92. onnxscript/onnx_opset/_impl/opset_ai_onnx_ml1.py +974 -0
  93. onnxscript/onnx_opset/_impl/opset_ai_onnx_ml2.py +112 -0
  94. onnxscript/onnx_opset/_impl/opset_ai_onnx_ml3.py +308 -0
  95. onnxscript/onnx_opset/_impl/opset_ai_onnx_ml4.py +129 -0
  96. onnxscript/onnx_opset/_impl/opset_ai_onnx_ml5.py +158 -0
  97. onnxscript/onnx_opset/_impl/opset_ai_onnx_preview_training1.py +577 -0
  98. onnxscript/onnx_types.py +229 -0
  99. onnxscript/optimizer/__init__.py +39 -0
  100. onnxscript/optimizer/_constant_folding.py +1083 -0
  101. onnxscript/optimizer/_inliner.py +312 -0
  102. onnxscript/optimizer/_legacy/_optimizer.py +98 -0
  103. onnxscript/optimizer/_legacy/_remove_unused_proto.py +144 -0
  104. onnxscript/optimizer/_legacy/_simple_function_folding.py +243 -0
  105. onnxscript/optimizer/_legacy/constant_folding.py +293 -0
  106. onnxscript/optimizer/_legacy/evaluator.py +439 -0
  107. onnxscript/optimizer/_optimizer.py +61 -0
  108. onnxscript/optimizer/_remove_unused.py +106 -0
  109. onnxscript/optimizer/_remove_unused_function.py +72 -0
  110. onnxscript/py.typed +1 -0
  111. onnxscript/rewriter/__init__.py +56 -0
  112. onnxscript/rewriter/_ir_utils.py +111 -0
  113. onnxscript/rewriter/broadcast_to_matmul.py +180 -0
  114. onnxscript/rewriter/cast_constant_of_shape.py +50 -0
  115. onnxscript/rewriter/collapse_slices.py +141 -0
  116. onnxscript/rewriter/erfgelu.py +27 -0
  117. onnxscript/rewriter/function_rule.py +232 -0
  118. onnxscript/rewriter/gemm_to_matmul_add.py +21 -0
  119. onnxscript/rewriter/generic_pattern.py +700 -0
  120. onnxscript/rewriter/llama_rule_sets.py +287 -0
  121. onnxscript/rewriter/no_op.py +56 -0
  122. onnxscript/rewriter/onnxruntime/__init__.py +50 -0
  123. onnxscript/rewriter/onnxruntime/bfloat16_utils/bfloat16_converter.py +99 -0
  124. onnxscript/rewriter/onnxruntime/fused_matmul_rule_sets.py +177 -0
  125. onnxscript/rewriter/onnxruntime/group_normalization_merge_silu.py +64 -0
  126. onnxscript/rewriter/onnxruntime/instance_to_group_normalization.py +155 -0
  127. onnxscript/rewriter/onnxruntime/softmax.py +63 -0
  128. onnxscript/rewriter/onnxruntime/transformers/__init__.py +21 -0
  129. onnxscript/rewriter/onnxruntime/transformers/biassplitgelu.py +31 -0
  130. onnxscript/rewriter/onnxruntime/transformers/fastgelu.py +29 -0
  131. onnxscript/rewriter/onnxruntime/transformers/layernorm.py +47 -0
  132. onnxscript/rewriter/onnxruntime/transformers/multihead_attention.py +715 -0
  133. onnxscript/rewriter/ort_fusions/__init__.py +9 -0
  134. onnxscript/rewriter/ort_fusions/_core.py +28 -0
  135. onnxscript/rewriter/ort_fusions/_smollm_1.py +253 -0
  136. onnxscript/rewriter/ort_fusions/_smollm_2.py +467 -0
  137. onnxscript/rewriter/ort_fusions/_test_models.py +122 -0
  138. onnxscript/rewriter/ort_fusions/_test_utils.py +42 -0
  139. onnxscript/rewriter/ort_fusions/cos_sin_cache.py +154 -0
  140. onnxscript/rewriter/ort_fusions/gqa.py +156 -0
  141. onnxscript/rewriter/ort_fusions/mha.py +198 -0
  142. onnxscript/rewriter/ort_fusions/rms_normalization.py +95 -0
  143. onnxscript/rewriter/ort_fusions/rotary_embedding.py +64 -0
  144. onnxscript/rewriter/ort_fusions/sdpa.py +75 -0
  145. onnxscript/rewriter/ort_fusions/skip_normalization.py +46 -0
  146. onnxscript/rewriter/pattern.py +1714 -0
  147. onnxscript/rewriter/testing.py +77 -0
  148. onnxscript/sourceinfo.py +59 -0
  149. onnxscript/tensor.py +227 -0
  150. onnxscript/testing/__init__.py +482 -0
  151. onnxscript/tools/__init__.py +4 -0
  152. onnxscript/tools/benchmark/__init__.py +23 -0
  153. onnxscript/tools/benchmark/benchmark_helpers.py +783 -0
  154. onnxscript/tools/benchmark/benchmark_run.py +140 -0
  155. onnxscript/tools/benchmark/export_model.py +207 -0
  156. onnxscript/tools/benchmark/export_model_batch.py +146 -0
  157. onnxscript/tools/memory_peak.py +244 -0
  158. onnxscript/tools/training_helper.py +50 -0
  159. onnxscript/tools/transformers_models/__init__.py +190 -0
  160. onnxscript/tools/transformers_models/llama.py +168 -0
  161. onnxscript/tools/transformers_models/mistral.py +238 -0
  162. onnxscript/tools/transformers_models/phi.py +248 -0
  163. onnxscript/tools/transformers_models/phi3.py +259 -0
  164. onnxscript/type_annotation.py +281 -0
  165. onnxscript/utils/__init__.py +0 -0
  166. onnxscript/utils/evaluation_utils.py +56 -0
  167. onnxscript/utils/timing_utils.py +33 -0
  168. onnxscript/utils/utils.py +84 -0
  169. onnxscript/values.py +790 -0
  170. onnxscript/version_converter/__init__.py +21 -0
  171. onnxscript/version_converter/_version_converter.py +314 -0
  172. onnxscript-0.1.0.dist-info/LICENSE +21 -0
  173. onnxscript-0.1.0.dist-info/METADATA +370 -0
  174. onnxscript-0.1.0.dist-info/RECORD +176 -0
  175. onnxscript-0.1.0.dist-info/WHEEL +5 -0
  176. onnxscript-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,370 @@
1
+ Metadata-Version: 2.2
2
+ Name: onnxscript
3
+ Version: 0.1.0
4
+ Summary: Naturally author ONNX functions and models using a subset of Python
5
+ Author-email: Microsoft Corporation <onnx@microsoft.com>
6
+ License: MIT License
7
+
8
+ Copyright (c) Microsoft Corporation
9
+
10
+ Permission is hereby granted, free of charge, to any person obtaining a copy
11
+ of this software and associated documentation files (the "Software"), to deal
12
+ in the Software without restriction, including without limitation the rights
13
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14
+ copies of the Software, and to permit persons to whom the Software is
15
+ furnished to do so, subject to the following conditions:
16
+
17
+ The above copyright notice and this permission notice shall be included in all
18
+ copies or substantial portions of the Software.
19
+
20
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
26
+ SOFTWARE.
27
+
28
+ Project-URL: Homepage, https://onnxscript.ai/
29
+ Project-URL: Repository, https://github.com/microsoft/onnxscript
30
+ Classifier: Development Status :: 4 - Beta
31
+ Classifier: Environment :: Console
32
+ Classifier: Intended Audience :: Developers
33
+ Classifier: Operating System :: POSIX
34
+ Classifier: Operating System :: MacOS :: MacOS X
35
+ Classifier: Operating System :: Microsoft :: Windows
36
+ Classifier: Programming Language :: Python :: 3.8
37
+ Classifier: Programming Language :: Python :: 3.9
38
+ Classifier: Programming Language :: Python :: 3.10
39
+ Classifier: Programming Language :: Python :: 3.11
40
+ Classifier: Programming Language :: Python :: 3.12
41
+ Classifier: Programming Language :: Python :: 3.13
42
+ Classifier: License :: OSI Approved :: MIT License
43
+ Requires-Python: >=3.8
44
+ Description-Content-Type: text/markdown
45
+ License-File: LICENSE
46
+ Requires-Dist: numpy
47
+ Requires-Dist: onnx>=1.16
48
+ Requires-Dist: typing_extensions>=4.10
49
+ Requires-Dist: ml_dtypes
50
+ Requires-Dist: packaging
51
+ Dynamic: project-url
52
+
53
+ # ONNX Script
54
+
55
+ [![CI](https://github.com/microsoft/onnxscript/actions/workflows/main.yaml/badge.svg)](https://github.com/microsoft/onnxscript/actions/workflows/main.yaml)
56
+ [![Dev Release](https://aiinfra.visualstudio.com/ONNX%20Converters/_apis/build/status%2Fonnxscript-release-dev?branchName=main&label=Dev%20Release)](https://aiinfra.visualstudio.com/ONNX%20Converters/_build/latest?definitionId=1258&branchName=main)
57
+ [![PyPI - Version](https://img.shields.io/pypi/v/onnxscript.svg)](https://pypi.org/project/onnxscript)
58
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/onnxscript.svg)](https://pypi.org/project/onnxscript)
59
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
60
+ [![Black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
61
+
62
+ ONNX Script enables developers to naturally author ONNX functions and
63
+ models using a subset of Python. ONNX Script is:
64
+
65
+ * **Expressive:** enables the authoring of all ONNX functions.
66
+ * **Simple and concise:** function code is natural and simple.
67
+ * **Debuggable:** allows for eager-mode evaluation that provides for a
68
+ more delightful ONNX model debugging experience.
69
+
70
+ This repo also covers:
71
+
72
+ * **ONNX IR:** an in-memory IR that supports the full ONNX spec, designed
73
+ for graph construction, analysis and transformation.
74
+ * **ONNX Script Optimizer:** provides functionality to optimize an ONNX
75
+ model by performing optimizations and clean-ups such as constant folding,
76
+ dead code elimination, etc.
77
+ * **ONNX Rewriter:** provides functionality to replace certain patterns in
78
+ an ONNX graph with replacement patterns based on user-defined rewrite rules.
79
+
80
+ Note however that ONNX Script does **not** intend to support the entirety
81
+ of the Python language.
82
+
83
+ Website: [https://onnxscript.ai/](https://onnxscript.ai/)
84
+
85
+ ## Design Overview
86
+
87
+ ONNX Script provides a few major capabilities for authoring and debugging
88
+ ONNX models and functions:
89
+
90
+ * A converter which translates a Python ONNX Script function into an
91
+ ONNX graph, accomplished by traversing the [Python Abstract Syntax Tree][python-ast] to build an ONNX graph equivalent of the function.
92
+
93
+ * A converter that operates inversely, translating ONNX models and
94
+ functions into ONNX Script. This capability can be used to fully round-trip
95
+ ONNX Script ↔ ONNX graph.
96
+
97
+ * A runtime shim that allows such functions to be evaluated
98
+ (in an "eager mode"). This functionality currently relies on
99
+ [ONNX Runtime][onnx-runtime] for executing every [ONNX Operator][onnx-ops],
100
+ and there is a Python-only reference runtime for ONNX underway that
101
+ will also be supported.
102
+
103
+ Note that the runtime is intended to help understand and debug function definitions. Performance is not a goal here.
104
+
105
+ ## Installing ONNX Script
106
+
107
+ ```bash
108
+ pip install --upgrade onnxscript
109
+ ```
110
+
111
+ ### Install for Development
112
+
113
+ ```bash
114
+ git clone https://github.com/microsoft/onnxscript
115
+ cd onnxscript
116
+ pip install -r requirements-dev.txt
117
+ pip install -e .
118
+ ```
119
+
120
+ ### Run Unit Tests
121
+
122
+ ```bash
123
+ pytest .
124
+ ```
125
+
126
+ ## Example
127
+
128
+ ```python update-readme
129
+ import onnx
130
+
131
+ # We use ONNX opset 15 to define the function below.
132
+ from onnxscript import FLOAT, script
133
+ from onnxscript import opset15 as op
134
+
135
+
136
+ # We use the script decorator to indicate that
137
+ # this is meant to be translated to ONNX.
138
+ @script()
139
+ def onnx_hardmax(X, axis: int):
140
+ """Hardmax is similar to ArgMax, with the result being encoded OneHot style."""
141
+
142
+ # The type annotation on X indicates that it is a float tensor of
143
+ # unknown rank. The type annotation on axis indicates that it will
144
+ # be treated as an int attribute in ONNX.
145
+ #
146
+ # Invoke ONNX opset 15 op ArgMax.
147
+ # Use unnamed arguments for ONNX input parameters, and named
148
+ # arguments for ONNX attribute parameters.
149
+ argmax = op.ArgMax(X, axis=axis, keepdims=False)
150
+ xshape = op.Shape(X, start=axis)
151
+ # use the Constant operator to create constant tensors
152
+ zero = op.Constant(value_ints=[0])
153
+ depth = op.GatherElements(xshape, zero)
154
+ empty_shape = op.Constant(value_ints=[0])
155
+ depth = op.Reshape(depth, empty_shape)
156
+ values = op.Constant(value_ints=[0, 1])
157
+ cast_values = op.CastLike(values, X)
158
+ return op.OneHot(argmax, depth, cast_values, axis=axis)
159
+
160
+
161
+ # We use the script decorator to indicate that
162
+ # this is meant to be translated to ONNX.
163
+ @script()
164
+ def sample_model(X: FLOAT[64, 128], Wt: FLOAT[128, 10], Bias: FLOAT[10]) -> FLOAT[64, 10]:
165
+ matmul = op.MatMul(X, Wt) + Bias
166
+ return onnx_hardmax(matmul, axis=1)
167
+
168
+
169
+ # onnx_model is an in-memory ModelProto
170
+ onnx_model = sample_model.to_model_proto()
171
+
172
+ # Save the ONNX model at a given path
173
+ onnx.save(onnx_model, "sample_model.onnx")
174
+
175
+ # Check the model
176
+ try:
177
+ onnx.checker.check_model(onnx_model)
178
+ except onnx.checker.ValidationError as e:
179
+ print(f"The model is invalid: {e}")
180
+ else:
181
+ print("The model is valid!")
182
+ ```
183
+
184
+ The decorator parses the code of the function, converting it into an
185
+ intermediate representation. If it fails, it produces an error message
186
+ indicating the line where the error was detected. If it succeeds, the
187
+ intermediate representation can be converted into an ONNX graph
188
+ structure of type `FunctionProto`:
189
+
190
+ * `Hardmax.to_function_proto()` returns a `FunctionProto`
191
+
192
+ ### Eager Mode Evaluation
193
+
194
+ Eager mode is mostly used to debug and validate that intermediate results
195
+ are as expected. The function defined above can be called as below,
196
+ executing in an eager-evaluation mode:
197
+
198
+ ```python
199
+ import numpy as np
200
+
201
+ v = np.array([[0, 1], [2, 3]], dtype=np.float32)
202
+ result = Hardmax(v)
203
+ ```
204
+
205
+ More examples can be found in the [docs/examples](docs/examples) directory.
206
+
207
+ ## ONNX IR
208
+
209
+ An in-memory IR that supports the full ONNX spec, designed for graph construction, analysis and transformation.
210
+
211
+ ### Features
212
+
213
+ * **Full ONNX spec support:** all valid models representable by ONNX protobuf,
214
+ and a subset of invalid models (so you can load and fix them).
215
+ * **Low memory footprint:** mmap'ed external tensors; unified interface for
216
+ ONNX TensorProto, Numpy arrays and PyTorch Tensors etc. No tensor size
217
+ limitation. Zero copies.
218
+ * **Straightforward access patterns:** Access value information and traverse the
219
+ graph topology at ease.
220
+ * **Robust mutation:** Create as many iterators as you like on the graph while mutating it.
221
+ * **Speed:** Performant graph manipulation, serialization/deserialization to Protobuf.
222
+ * **Pythonic and familiar APIs:** Classes define Pythonic apis and still map to
223
+ ONNX protobuf concepts in an intuitive way.
224
+
225
+ ## ONNX Script Tools
226
+
227
+ ### ONNX Optimizer
228
+
229
+ The ONNX Script Optimizer tool provides the user with the functionality to optimize an ONNX model by performing optimizations and clean-ups such as constant folding, dead code elimination, etc. In order to utilize the optimizer tool:
230
+
231
+ ```python
232
+ import onnxscript
233
+
234
+ onnxscript.optimizer.optimize(onnx_model)
235
+ ```
236
+
237
+ For a detailed summary of all the optimizations applied by the optimizer call, refer to the tutorial [Optimizing a Model using the Optimizer](https://onnxscript.ai/tutorial/optimizer/optimize.html)
238
+
239
+ ### ONNX Rewriter
240
+
241
+ The ONNX Rewriter tool provides the user with the functionality to replace certain patterns in an ONNX graph with another pattern based on user-defined rewrite rules. The rewriter tools allows two different methods in which patterns in the graph can be rewritten.
242
+
243
+ ### Pattern-based rewriting
244
+
245
+ For this style of rewriting, the user provides a `target_pattern` that is to be replaced, a `replacement_pattern` and a `match_condition` (pattern rewrite will occur only if the match condition is satisfied). A simple example on how to use the pattern-based rewriting tool is as follows:
246
+
247
+ ```python
248
+ from onnxscript.rewriter import pattern
249
+
250
+ # The target pattern
251
+ def erf_gelu_pattern(op, x):
252
+ return 0.5 * (x * (op.Erf(x / math.sqrt(2)) + 1.0))
253
+
254
+ def erf_gelu_pattern_2(op, x):
255
+ return (x * (op.Erf(x / math.sqrt(2)) + 1.0)) * 0.5
256
+
257
+ # The replacement pattern
258
+ def gelu(op, x: ir.Value):
259
+ return op.Gelu(x, domain="com.microsoft")
260
+
261
+ # Create multiple rules
262
+ rule1 = pattern.RewriteRule(
263
+ erf_gelu_pattern, # Target Pattern
264
+ gelu, # Replacement
265
+ )
266
+ rule2 = pattern.RewriteRule(
267
+ erf_gelu_pattern_2, # Target Pattern
268
+ gelu, # Replacement
269
+ )
270
+ # Create a Rewrite Rule Set with multiple rules.
271
+ rewrite_rule_set = pattern.RewriteRuleSet([rule1, rule2])
272
+ # Apply rewrites
273
+ model_with_rewrite_applied = onnxscript.rewriter.rewrite(
274
+ model, # Original ONNX Model
275
+ pattern_rewrite_rules=rewrite_rule_set,
276
+ )
277
+ return model_with_rewrite_applied
278
+ ```
279
+
280
+ For a detailed tutorial on how to create target_pattern, replacement_pattern and match_condition blocks in order to utilize the pattern-based rewriter, refer to the tutorial [Pattern-based Rewrite Using Rules](https://onnxscript.ai/tutorial/rewriter/rewrite_patterns.html)
281
+
282
+ ### Function-based rewriting
283
+
284
+ This style of rewriting matches a `FUNCTION_KEYWORD` and `PACKAGE_NAME` provided by the user to an existing function within the graph and replaces it with a new function provided by the user.
285
+
286
+ ## Development Guidelines
287
+
288
+ Every change impacting the converter or the eager evaluation must be
289
+ unit tested with class `OnnxScriptTestCase` to ensure both systems do
290
+ return the same results with the same inputs.
291
+
292
+ ### Coding Style
293
+
294
+ We use `ruff`, `black`, `isort`, and `mypy` etc. to check code formatting and use `lintrunner` to run all linters.
295
+ You can install the dependencies and initialize with
296
+
297
+ ```sh
298
+ pip install lintrunner lintrunner-adapters
299
+ lintrunner init
300
+ ```
301
+
302
+ This will install lintrunner on your system and download all the necessary dependencies to run linters locally.
303
+ If you want to see what lintrunner init will install, run `lintrunner init --dry-run`.
304
+
305
+ To lint local changes:
306
+
307
+ ```bash
308
+ lintrunner
309
+ ```
310
+
311
+ To format files:
312
+
313
+ ```bash
314
+ lintrunner f
315
+ ```
316
+
317
+ To lint all files:
318
+
319
+ ```bash
320
+ lintrunner --all-files
321
+ ```
322
+
323
+ Use `--output oneline` to produce a compact list of lint errors, useful when
324
+ there are many errors to fix.
325
+
326
+ See all available options with `lintrunner -h`.
327
+
328
+ To read more about lintrunner, see [wiki](https://github.com/pytorch/pytorch/wiki/lintrunner).
329
+ To update an existing linting rule or create a new one, modify `.lintrunner.toml` or create a
330
+ new adapter following examples in https://github.com/justinchuby/lintrunner-adapters.
331
+
332
+ ## Contributing
333
+
334
+ We're always looking for your help to improve the product (bug fixes, new features, documentation, etc). Currently ONNX Script is under early and heavy development, so we encourage proposing any major changes by [filing an issue](https://github.com/microsoft/onnxscript/issues) to discuss your idea with the team first.
335
+
336
+ ### Report a Security Issue
337
+
338
+ **Please do not report security vulnerabilities through public GitHub issues.**
339
+
340
+ Please refer to our guidance on filing [Security Issues](SECURITY.md).
341
+
342
+ ### Licensing Guidelines
343
+
344
+ This project welcomes contributions and suggestions. Most contributions require you to
345
+ agree to a Contributor License Agreement (CLA) declaring that you have the right to,
346
+ and actually do, grant us the rights to use your contribution. For details, visit
347
+ https://cla.microsoft.com.
348
+
349
+ When you submit a pull request, a CLA-bot will automatically determine whether you need
350
+ to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
351
+ instructions provided by the bot. You will only need to do this once across all repositories using our CLA.
352
+
353
+ ### Code of Conduct
354
+
355
+ This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
356
+ For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
357
+ or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.
358
+
359
+ ## Trademarks
360
+
361
+ This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft
362
+ trademarks or logos is subject to and must follow
363
+ [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general).
364
+ Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship.
365
+ Any use of third-party trademarks or logos is subject to those third-party's policies.
366
+
367
+ [python-ast]: https://docs.python.org/3/library/ast.html
368
+ [onnx-runtime]: https://onnxruntime.ai
369
+ [onnx-ops]: https://github.com/onnx/onnx/blob/main/docs/Operators.md
370
+ [onnxfns1A.py]: https://github.com/microsoft/onnxscript/blob/main/onnxscript/tests/models/onnxfns1A.py
@@ -0,0 +1,176 @@
1
+ onnxscript/__init__.py,sha256=lWsGVBTdgKI6hjjAP_sxDsbyaEth5GPPjdrZZsyhsko,2196
2
+ onnxscript/converter.py,sha256=9UM5laDOVyvuHWs6VQW1CoZZbx3mUtbVGQhNOS2gzSo,61465
3
+ onnxscript/evaluator.py,sha256=of6AYrfQ3UrNqsbtxiXj25oIWOLmHXE--sWd1cvcH3s,22067
4
+ onnxscript/irbuilder.py,sha256=lyfX92B8_UGrrcvcueWbPsy9A1IiN8-F8L1muCDgsMg,19703
5
+ onnxscript/main.py,sha256=tcbxmgVlOmrQEOlvaDWB6nyZrtPwg5qGLYjEsgrDQNE,6230
6
+ onnxscript/onnx_types.py,sha256=OQ9HWslFRDX-TKRjAlZcS5Nr4BXH1KKGpw7-QFsVlUg,5995
7
+ onnxscript/py.typed,sha256=RE0PXsiTLVMTQt0hpvcu9Z2YnRJBMD8SgAkcomtLAho,41
8
+ onnxscript/sourceinfo.py,sha256=QxXk1sfB84V04fxvWlQabhM_RTsQwXRZKKyJEswBqPI,1701
9
+ onnxscript/tensor.py,sha256=tTWN2c6qMFt-7a5NBNog3O49GKZwSO1o3XxUtzso1MM,7484
10
+ onnxscript/type_annotation.py,sha256=LKJKF0kErkXhLD0TpCBl-B27khcj45s8wX2y6r-IgzU,10851
11
+ onnxscript/values.py,sha256=UBmy_sd59teWe_geSq5dk7e7lcfpANn62Gy0W6k9sJw,27193
12
+ onnxscript/_framework_apis/__init__.py,sha256=ED8FlQKlouoVJqkBvAZz99xS7eOu2ZwsKXA2RO6mQHQ,139
13
+ onnxscript/_framework_apis/torch_2_5.py,sha256=1P-e8zo9Dh5_jzJBbnXW-Y_NJMSYvI9S-IhnLBRVB4U,3629
14
+ onnxscript/_framework_apis/torch_2_6.py,sha256=fhIDJ9DLKxNh7UqhSzFkztX3kIYOqGQcgZtO7ICpxkY,1052
15
+ onnxscript/_internal/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
16
+ onnxscript/_internal/analysis.py,sha256=UYExg19Q3ntrEcRUcWFJb5qbyBcL7acgpKRJHNDgF-8,9139
17
+ onnxscript/_internal/ast_utils.py,sha256=oz5jR1kMt9JQOi-gplNFXVINJWhPURamF_ls0619fGs,2302
18
+ onnxscript/_internal/autocast.py,sha256=19wo1ELT_eaiYRypsdTqZGUcA1cB8OcBX_aOBHDkWOc,9637
19
+ onnxscript/_internal/deprecation.py,sha256=6apa3YmGB-Ms7jsJgzEqfEpFTxr29xOzdozbHH2SHFQ,2500
20
+ onnxscript/_internal/param_manipulation.py,sha256=vK6CTAyfPh1cqe-Y8INAHOzd2-3NrDi2XbOSWwn7pEo,5772
21
+ onnxscript/_internal/runtime_typing.py,sha256=_u7kNcwfZakIeID_oGGlLw6QUf7Xd50jGiBqOD2m8rk,1334
22
+ onnxscript/_internal/utils.py,sha256=C9233M0zOXZLpJDZFH3BeHemNIKQcjpOfINhiWcE5Cg,3349
23
+ onnxscript/_internal/version_utils.py,sha256=fDJMHm5lxv-Q1Iz4KJ8kM9pmFFUymz1zi0a_uDF0Js4,3281
24
+ onnxscript/_legacy_ir/__init__.py,sha256=X6vc3eF94QJXD7Re6MF33R8FEARE_SYQ7vJfxKz5nQU,11389
25
+ onnxscript/_legacy_ir/visitor.py,sha256=sS8HSXM4YZ4sLluvh06ELjFQyKEjQw4z74hmWkJcfIk,36820
26
+ onnxscript/_thirdparty/asciichartpy.py,sha256=wgqaJBjSZRvftSzQO8TPyldnYt5wUlApKAc9GxFVZpw,10599
27
+ onnxscript/backend/__init__.py,sha256=HIog-luBqQnLkza1Q8b34Rr1QVu6tuiAy5sOry0vIPg,73
28
+ onnxscript/backend/onnx_backend.py,sha256=ticy_w--Q8ktepcZ7Bs0-wnLYpzr5xbNn_h0_FsXifU,11325
29
+ onnxscript/backend/onnx_export.py,sha256=uwAgC2cN5ZMq9ehnCCCKjLBmQzi1Hz7uQHX0VpQNF5I,33176
30
+ onnxscript/function_libs/tools/torch_lib/deduce_type_constraints.py,sha256=6hUW83nBso_6871cZ9QF3-A1um4tZ7VbAvggU4Dt8dk,16396
31
+ onnxscript/function_libs/tools/torch_lib/generate_aten_signatures.py,sha256=2n-ouwda6ezK1mnBa0mQyttCId0ScUwdjDCxYqCDe88,11783
32
+ onnxscript/function_libs/tools/torch_lib/generate_prims_signatures.py,sha256=chP9IVhTfh4Wx0Z9ypWTGT276aSHXP54NYjwK3IBJ10,11851
33
+ onnxscript/function_libs/torch_lib/__init__.py,sha256=FkQReFgAQBm8OQC679QKxaP7BodjgpHpx9i4Y5nyNYI,222
34
+ onnxscript/function_libs/torch_lib/_constants.py,sha256=iySTPTswYcflL68tfgdSBurjWDc77mEVa3h51ItGY0o,150
35
+ onnxscript/function_libs/torch_lib/_flags.py,sha256=QjzyrornnMsrdK78D6IW3fcZKvT3c6C0rmE6JITYX9k,1731
36
+ onnxscript/function_libs/torch_lib/registration.py,sha256=l6YLsQeaok7i9796KJrQE6a3rk8bkML1x20eJ4xyblg,5518
37
+ onnxscript/function_libs/torch_lib/tensor_typing.py,sha256=sZqIrMnihn_Q72ybaTRoF3fR05OsqRLGmmKNk9W0I0A,2034
38
+ onnxscript/function_libs/torch_lib/graph_building/__init__.py,sha256=0pSqwK7__f2fRM1VVybX_QCU37v2LKX4KXo-RUrdYqc,2364
39
+ onnxscript/function_libs/torch_lib/graph_building/_graph_building_ir.py,sha256=g3Cyq_MCnOdXQtPoo7HHiRbVi_bxRh62aY60PrLGs9M,27494
40
+ onnxscript/function_libs/torch_lib/graph_building/_graph_building_torch.py,sha256=E-7h1N-IstC_xZnUY71G9x53i9WrQTcuCxFqS58jKMg,45527
41
+ onnxscript/function_libs/torch_lib/ops/__init__.py,sha256=0jIa7coVtLRw-rloeBuR0nnhKJpElKlY22n73bQQEvU,376
42
+ onnxscript/function_libs/torch_lib/ops/common.py,sha256=781GW_Z3xq3UZbbn_uPdT0pLawKdpDT_U8GBXIVXtGM,2702
43
+ onnxscript/function_libs/torch_lib/ops/core.py,sha256=zwwSMJqcz65r9iiVIsIF9bM6Hjc9431__6Hy4DRhSNg,292771
44
+ onnxscript/function_libs/torch_lib/ops/fft.py,sha256=2rvgdU3aKPrt5NoBSMgHcmmsldVG6HsJIAr_n4rdt4w,12343
45
+ onnxscript/function_libs/torch_lib/ops/linalg.py,sha256=rVfCTREUs4kGHv5sjis4cF0kY9Ff3MfKrAWHvHqbx6U,13317
46
+ onnxscript/function_libs/torch_lib/ops/nested.py,sha256=qIZJbqaxQIVxT4ovwyLtnk-VBxA7kTy4Dyyuc-fuUy8,911
47
+ onnxscript/function_libs/torch_lib/ops/nn.py,sha256=hKp0c1yISbyw2nlvc6iXkCvN34JdJQke9oqsICJfVgQ,93165
48
+ onnxscript/function_libs/torch_lib/ops/prims.py,sha256=iRnab_YTWBw4c2eHdeupvzzkNXXqKg2QTqqv72Y85KY,22710
49
+ onnxscript/function_libs/torch_lib/ops/quantized_decomposed.py,sha256=aw_rBeI4wIk9TqN3y4a60_XoOkD4519-kN67VVKPct0,2080
50
+ onnxscript/function_libs/torch_lib/ops/sparse.py,sha256=HsQw9FnZVJwwv2-El35SeBqxVfUF0SRoWiORLMKq7vQ,920
51
+ onnxscript/function_libs/torch_lib/ops/special.py,sha256=iHe8ywsmbQ2BSGa_DSuePEr_TO-0eZqAUVrmZZ9Y2XI,11241
52
+ onnxscript/function_libs/torch_lib/ops/vision.py,sha256=TcJ3n6JJDMC-PIj6bIcbUavNzOMn_cL972R7cqHGOJg,1155
53
+ onnxscript/ir/__init__.py,sha256=fv0no16C4JPOs8gfzWqctS6N8CTeGT2YlJc6OqYdptk,3081
54
+ onnxscript/ir/_convenience.py,sha256=Aa1kumjihSO4-CzryVuim6b94rTk-ffyusBrnkpqaJo,16928
55
+ onnxscript/ir/_core.py,sha256=TjL30LKjG2JyWnvZMBRD7FbBzxTUwEcpVfHOHvGQglQ,113931
56
+ onnxscript/ir/_display.py,sha256=6x5QQwpA4ugEhbCZ8ZzFGMNcpNlnjXQIftJrT-cb61c,1293
57
+ onnxscript/ir/_enums.py,sha256=ZZp77TeZBUwq7_HfbcQLJRGDSIN9SHuCwXqsLRaOuUk,4407
58
+ onnxscript/ir/_graph_comparison.py,sha256=DKdG0ZWLAkMbrS-sSIStNKNcL4gotV_dZXODrSyxoOU,726
59
+ onnxscript/ir/_io.py,sha256=tYg9eFdNpmImprKfpMsXELShqhG560gJdV-uZEwHL_g,3922
60
+ onnxscript/ir/_linked_list.py,sha256=P7QmLQAFmk9-CwP9U0Lhqf85bbGYR0N8P_Xky91l5OY,10346
61
+ onnxscript/ir/_metadata.py,sha256=4SL4m-GiRO3z0fcOfXzye-5QwFwKxFacqoVx3_AzyVI,1510
62
+ onnxscript/ir/_name_authority.py,sha256=JH__OlCHEAJaTuHVy1AeHlWTOpLmRJRMEybdvApRhuo,3035
63
+ onnxscript/ir/_polyfill.py,sha256=UciNhsnHZMwzYixpCSHEG58uX3uTuS0q0gqBFbMlC50,853
64
+ onnxscript/ir/_protocols.py,sha256=byzO44V1-ciDJb1rZqYPEb2J_-mSi03DanfvmLViwCQ,20824
65
+ onnxscript/ir/_schemas.py,sha256=8bWSLGnpPqTN07rlRIa6Khf1sEh1oevCwG9PpHgMa5g,20189
66
+ onnxscript/ir/_tape.py,sha256=NS7-6D9knANxF0RzIUdV0AOXtfUZhzF6jnfM4AUN8qM,4084
67
+ onnxscript/ir/_type_casting.py,sha256=h3U8n4DgjqMW08KxBFbwq8kRe22eUykifpujOkhgs5c,3299
68
+ onnxscript/ir/convenience.py,sha256=cWrJ4a1VDyHc6k39OGMpXX5wUYBaSHHSktNz4hGAH7c,816
69
+ onnxscript/ir/external_data.py,sha256=EkrDU6vRPXPQUajUyfJPYEY-VBDEU9VV1Yv8-Myczn8,16312
70
+ onnxscript/ir/serde.py,sha256=e1bkDX3JF-1YZJ89j6f4U7df-IQQUQtqx6Q5i_zlfsw,66323
71
+ onnxscript/ir/tensor_adapters.py,sha256=mR9SvTh0aGNGZ3VcBw51hUlIbfsvu9RRYKjEq_neTbU,4467
72
+ onnxscript/ir/traversal.py,sha256=5gWIgTgJoMgoUBbXVaIJncIzz-vqA2t2qgjDkxuslfw,2835
73
+ onnxscript/ir/passes/__init__.py,sha256=l3wHljMzyCWejNr9rKp2sPJLQOSA59m8MCN5jJp3GiE,651
74
+ onnxscript/ir/passes/_pass_infra.py,sha256=9mDRTQiNc1uH1Y-36J8N7ESiSwaKCe_5IG1rifRdICg,5371
75
+ onnxscript/onnx_opset/__init__.py,sha256=24zJ86pTrc1fmWlIriofK0kmE3i-CEiOw9vl7brIgdg,5332
76
+ onnxscript/onnx_opset/_impl/opset1.py,sha256=Y3NoHn8vnEGXZpp3aCmN3oZEry90yMWBLG_5QrSWQNM,153805
77
+ onnxscript/onnx_opset/_impl/opset10.py,sha256=qL-5UZ-s2KBldCfVAL8ikJvF14PFnfVSyYi7e5gakAU,53425
78
+ onnxscript/onnx_opset/_impl/opset11.py,sha256=t-0g-zIaNJHMZFmC5eqChRSTIqwa39_-QNEb9mC6Rms,157595
79
+ onnxscript/onnx_opset/_impl/opset12.py,sha256=OibfE_CRZ1Xx6QHMgbFSjZn9lqwgaPlclG7DYJHHDeQ,43460
80
+ onnxscript/onnx_opset/_impl/opset13.py,sha256=TFNGkOUzuvij7gtm4jJMcuTm-ZwbcP_aipdphci4RbU,140735
81
+ onnxscript/onnx_opset/_impl/opset14.py,sha256=A2MRrF57_hIvh5ZrM1a-zc99bujJNgh_Rc0TZ19YSS4,41780
82
+ onnxscript/onnx_opset/_impl/opset15.py,sha256=tx6A5c8r2smuM30312MIoTlVa5TWke4qD0k-B2eJ3Jg,19290
83
+ onnxscript/onnx_opset/_impl/opset16.py,sha256=uXLa84nryQnyzZdFfv16aAvJbX_GDvriYP7WabjlouY,50662
84
+ onnxscript/onnx_opset/_impl/opset17.py,sha256=gb9A6-JspSzUhQbLZHuMGhbT46Yntge6nmoWzCUlO48,21513
85
+ onnxscript/onnx_opset/_impl/opset18.py,sha256=Oit2qaZgBtdlRvfAC-qew6eWneCMRD3tej4gNT3JQ-k,70208
86
+ onnxscript/onnx_opset/_impl/opset19.py,sha256=2rUBqf9-FpbrfFzccbxCadDyacy4yrbMdJsW-mkQsv4,75163
87
+ onnxscript/onnx_opset/_impl/opset2.py,sha256=Q_WVZpSDOKCUWb-4M5b4H37hwZhCoo-kE9TeT5pSuc0,7961
88
+ onnxscript/onnx_opset/_impl/opset20.py,sha256=Ics3uA91dG7E6Anj10Qk1-truykoGjDtgtvpyS_RcCU,28284
89
+ onnxscript/onnx_opset/_impl/opset21.py,sha256=7yWRsGPVSxriJVM_NdzK07dfCS27onPLPAqD3Wqtwsc,71250
90
+ onnxscript/onnx_opset/_impl/opset22.py,sha256=gGG9pmDgqvJckovmyVewRvGDa8fD6Q1J3fv3PRJAkWI,113457
91
+ onnxscript/onnx_opset/_impl/opset3.py,sha256=ZWZWXlOyfWnDF4NyXa0b5B0eLsjnzs9HGtxaIVHyIgE,7645
92
+ onnxscript/onnx_opset/_impl/opset4.py,sha256=rtqoOZfTX5ZL_y2k3_QY7c6YHzDz6oEU3NCy8c3vMPY,1966
93
+ onnxscript/onnx_opset/_impl/opset5.py,sha256=b-z336UXH2qOz_hZDfc1Zte04m32ylTZyn5YugfusQg,2572
94
+ onnxscript/onnx_opset/_impl/opset6.py,sha256=oIVQduxBILDl8rQ91-b6gm9w1qmM2EXxe-nDahOJnxA,33248
95
+ onnxscript/onnx_opset/_impl/opset7.py,sha256=gFR0TsWKQ0ov3spcOS7e1dx-2MEq7LW7rmUzKoYJSMc,49053
96
+ onnxscript/onnx_opset/_impl/opset8.py,sha256=HbmLAqjQ3SMScFWrm83nuGygdEe0CfbKT3Ag1xSIG64,19393
97
+ onnxscript/onnx_opset/_impl/opset9.py,sha256=CtTLcx0o3iYgokl2t2J4BGVr-m5XTaR0hhOiIbLkKFg,58403
98
+ onnxscript/onnx_opset/_impl/opset_ai_onnx_ml1.py,sha256=V1A5FD9z4Gbkd71poFpLtGR7DzHEoML-Ml2ODtriMCo,39030
99
+ onnxscript/onnx_opset/_impl/opset_ai_onnx_ml2.py,sha256=F3HICs9cn5e3lxTKo6KBzGz7tNf-N-Hft74mRB-Rb1Y,4439
100
+ onnxscript/onnx_opset/_impl/opset_ai_onnx_ml3.py,sha256=00KVq9GizjMrQotOo8iBfEkA4yWJWyWlnnm_p9YrF0Q,13894
101
+ onnxscript/onnx_opset/_impl/opset_ai_onnx_ml4.py,sha256=48uU5nhBIcPavaKs5T7kVi5mTfD_wQiLRtg2gG1Ftdk,5368
102
+ onnxscript/onnx_opset/_impl/opset_ai_onnx_ml5.py,sha256=uSY8k2PrBJ-HvNhSFVZnNJ6KcWNeUWTHpNGauxUhi8E,8000
103
+ onnxscript/onnx_opset/_impl/opset_ai_onnx_preview_training1.py,sha256=HGlu60HWKQgI3gitoDo3WIw8KSy0qlWqaD_FGWlsqCE,24713
104
+ onnxscript/optimizer/__init__.py,sha256=tkzl5bvHXsWHpZqgBZfXZ0ec4KTp9GlNbb0pilLH5Oo,1269
105
+ onnxscript/optimizer/_constant_folding.py,sha256=ys-YrAchCueQDGgnRiSAgEviHFkjsWf6u475QV7f_iE,38828
106
+ onnxscript/optimizer/_inliner.py,sha256=2J1_L2GKvAYK5zavWNO-qHfWDIxFJo3KwsR7F4CBZiw,12950
107
+ onnxscript/optimizer/_optimizer.py,sha256=jMvCq3s06H86eAJGJnw0nDJt8c3qEsNKFMi2jiZZARI,2258
108
+ onnxscript/optimizer/_remove_unused.py,sha256=nK1uw3RGPLriCpI404USxEo_2HS2d_gSZJ2qtOzdMV4,3941
109
+ onnxscript/optimizer/_remove_unused_function.py,sha256=IufCIrdfNQgCEOi-mo-I-l21wNH_noD1lIKME38u-R8,2459
110
+ onnxscript/optimizer/_legacy/_optimizer.py,sha256=-FYAJc_FUizrFK821YaZ45GLFBZ_2WzX1wuUNOtQCPk,4127
111
+ onnxscript/optimizer/_legacy/_remove_unused_proto.py,sha256=KpI9QfMvRem_TZ11cmD5JHVETehsJ0xzhdZzEkvLKiE,4517
112
+ onnxscript/optimizer/_legacy/_simple_function_folding.py,sha256=NIUrrE0NxdtaR9ay73ltvKjg1lV1oY6lg309Oz-5CUs,10073
113
+ onnxscript/optimizer/_legacy/constant_folding.py,sha256=q21tKwHnbw5NVUfocegLP7XZF9O6I72Hm0f5QXpQNZA,10931
114
+ onnxscript/optimizer/_legacy/evaluator.py,sha256=LJhiXxPPh33WBbGbbH-qAFP-K1lXIxbkDNGgc8pT8lQ,15629
115
+ onnxscript/rewriter/__init__.py,sha256=iccpdtDMh_R_fpi27Z_RK-qgwAMTUMZiDU-sRB81wIo,1899
116
+ onnxscript/rewriter/_ir_utils.py,sha256=jmyu3c5ev9dFPP8geX7KbBlKQGlwJgwxAktcluoZmO8,3838
117
+ onnxscript/rewriter/broadcast_to_matmul.py,sha256=mYapxn1zIhUsXbq0OM3vQnTfD8YMdPCu_kWwUTJ2AlE,7347
118
+ onnxscript/rewriter/cast_constant_of_shape.py,sha256=hCmUdOVtuekqxo73-Zd0o35THDBFoVJFGGbRsBbMaus,1480
119
+ onnxscript/rewriter/collapse_slices.py,sha256=WXD2hPQ9p7z6tX7_NZ05ZOt0W9DswgR01puCBHqRQbk,4794
120
+ onnxscript/rewriter/erfgelu.py,sha256=n_4QUmwmdYL1HG-SMdQsIYppFIEBy7MOH_9ZPYnK-EQ,738
121
+ onnxscript/rewriter/function_rule.py,sha256=VPUzxuusogb6UGOxDl9KEs_q3Dtt3CR2R5ghfXA1gUo,8640
122
+ onnxscript/rewriter/gemm_to_matmul_add.py,sha256=g02nDW0wVh3AuZOHjBtHzWEeW9UZJlJ37vfRPjcn0XY,811
123
+ onnxscript/rewriter/generic_pattern.py,sha256=P4W0MqrWJwsCVOS3yZuQf50LLlI_ZY-frjYDcx_8QCA,28109
124
+ onnxscript/rewriter/llama_rule_sets.py,sha256=_6-wDYykRA4k0PEgpDKDPeHr-Ib8-OIdx2D7wia9rvk,9182
125
+ onnxscript/rewriter/no_op.py,sha256=sTydDyl1-uFefZfAWjxLK7pPMpURTVwwUj89u7_ceRo,1243
126
+ onnxscript/rewriter/pattern.py,sha256=gL9yhS_e-htAgXqFvTFR90YF7je7ts4AfF6L2og2Kjs,65532
127
+ onnxscript/rewriter/testing.py,sha256=3xHThBK6-R2D3sUDMFGg6WGUfMPQzP2zZ_rKc6bYQS4,2685
128
+ onnxscript/rewriter/onnxruntime/__init__.py,sha256=Hgc8KQe3lDWcQfr2a70xfJraOwSBx6E4b8AeyYOJCSw,1676
129
+ onnxscript/rewriter/onnxruntime/fused_matmul_rule_sets.py,sha256=gJXbrvD0qVIupXyH2KAwFujP6Iql8Z3TQfJivWvletk,5908
130
+ onnxscript/rewriter/onnxruntime/group_normalization_merge_silu.py,sha256=fjCrm81O58SJ4vFzzEGOgRbBhvmM3k2e-Fc23n9Timg,1349
131
+ onnxscript/rewriter/onnxruntime/instance_to_group_normalization.py,sha256=tL0EVL2PEArE5LPWmlvyzW38tdDMomlJwLQpTrGqwtU,5242
132
+ onnxscript/rewriter/onnxruntime/softmax.py,sha256=wB3HC2XmAJXAq3-yqlORFSKVp2rJ67JCHSF8yROXeHw,1894
133
+ onnxscript/rewriter/onnxruntime/bfloat16_utils/bfloat16_converter.py,sha256=zNbLMOCompYLIDBPBzvhUC23Y7IC0ZLPxGn4jcB0mjQ,3357
134
+ onnxscript/rewriter/onnxruntime/transformers/__init__.py,sha256=t5CDF8Dn-O-IrCQnGNmMk8nokvkHRBym9fYKLWD3fNQ,675
135
+ onnxscript/rewriter/onnxruntime/transformers/biassplitgelu.py,sha256=a2Istd0FzhIgFQbLah3nslKMq0RPCHkQCBAJg-S1DY8,1092
136
+ onnxscript/rewriter/onnxruntime/transformers/fastgelu.py,sha256=ASFLyV91EACeBTtBScsMctI0Y3dj64872QMTWx9Zkko,899
137
+ onnxscript/rewriter/onnxruntime/transformers/layernorm.py,sha256=oY3dPfgZovIA_liOjGw3ahB11WVUkHWENemJ6Qe0u-g,1801
138
+ onnxscript/rewriter/onnxruntime/transformers/multihead_attention.py,sha256=zKd8ES13xnp2wcVt_sEUz7UC6Pk9k8tVCW07UZug8K8,29711
139
+ onnxscript/rewriter/ort_fusions/__init__.py,sha256=-kpu_gUmiNs8cUTKhvqbwOcEBZtrloc1VwhSTVJoQJw,224
140
+ onnxscript/rewriter/ort_fusions/_core.py,sha256=ZW4keND1JgdemoQFvGRfs9uLAknk5smNLjk-2nnA4lc,1031
141
+ onnxscript/rewriter/ort_fusions/_smollm_1.py,sha256=uLVzivLzAnwTIdGDj3IDWHZowa5k-pwh1MJVqwTHsF0,11043
142
+ onnxscript/rewriter/ort_fusions/_smollm_2.py,sha256=HCGrQ0EI5KDIwKyueMaIinSBs5T5JksWtI0tznCpYec,23201
143
+ onnxscript/rewriter/ort_fusions/_test_models.py,sha256=0V9rRQFEKTwIaJL5BGemClPko3ESnA6QaNNwpQhWNec,4059
144
+ onnxscript/rewriter/ort_fusions/_test_utils.py,sha256=V-w0PsrIM1KN0BLmc6y_55d2dV4gfOkE73FLDqUA5ds,1345
145
+ onnxscript/rewriter/ort_fusions/cos_sin_cache.py,sha256=p-2nYGF_i4oAw6Zvqx3oib8kfrmNILcR912TlUIKOLw,6301
146
+ onnxscript/rewriter/ort_fusions/gqa.py,sha256=AhqFvKxrcREphT-LApLjl4p6yAD6ECH3H3-qyR2cCzs,5209
147
+ onnxscript/rewriter/ort_fusions/mha.py,sha256=dbwMWTM_r04VoULc3JDelouZ9xXBTv02qy7TZnmkqMU,6547
148
+ onnxscript/rewriter/ort_fusions/rms_normalization.py,sha256=jIQbyIm90x81F9SSW2eISjkY-5RPitb5v1DvTS7n8cA,4023
149
+ onnxscript/rewriter/ort_fusions/rotary_embedding.py,sha256=XvPkdt1mNX-qE0ry6KRISTAbixbfMxx3R_WDYOPbHzM,2530
150
+ onnxscript/rewriter/ort_fusions/sdpa.py,sha256=1Q19dCMYPebFNiM3TMXjk-qNZ0MCvIZfzBz3-gjSPJU,3007
151
+ onnxscript/rewriter/ort_fusions/skip_normalization.py,sha256=EhL-yW2swHNUHgglb3ilXE8M0CpaCJUiu0GtUHB477g,1340
152
+ onnxscript/testing/__init__.py,sha256=6JLqehovkZyT5G09pNB1u5ubY4XUqkXz-3N2ZO-eNfU,17996
153
+ onnxscript/tools/__init__.py,sha256=WSNxt3l4lkWA_0vhw1ED4I7KOO0mnAuHwSgFYqbq0Lg,247
154
+ onnxscript/tools/memory_peak.py,sha256=XGPm7MbRhi2it8F7ecUXaNV_pSn5-IBt8ez7p9yv4Jk,6341
155
+ onnxscript/tools/training_helper.py,sha256=2vgKwcQ83WmwJWrMWymREsfcVtSv9SaTR5nkLm5PGpY,1749
156
+ onnxscript/tools/benchmark/__init__.py,sha256=IVuAD2gN1C6x3G_Zjhnb29z8x0-QGE3J51tfbJTrysA,649
157
+ onnxscript/tools/benchmark/benchmark_helpers.py,sha256=oyh9qRnaliff9teGZ88bGo8TnUgGvmmZgLbG9aq_9DM,24954
158
+ onnxscript/tools/benchmark/benchmark_run.py,sha256=ogk5UsfcQhVyyHCRPrbXBWanHuwnReBKVK1QuuVHLkI,4504
159
+ onnxscript/tools/benchmark/export_model.py,sha256=-i0aDGt_6CHzKhEemRDVZDEylyZ8qAmjYR3wbN3Lduo,8708
160
+ onnxscript/tools/benchmark/export_model_batch.py,sha256=jspg8m2cuLcmNwRpbM7J4S7x6Kb9IXWaFwgSuuuhvYk,4735
161
+ onnxscript/tools/transformers_models/__init__.py,sha256=6MssVjHfH6UsEuFynNoqkrufImPwUIErwZk_q_Fumpg,5973
162
+ onnxscript/tools/transformers_models/llama.py,sha256=ifwqeqBNryoDj6r1wXEASHxC--WFX7_4K1fRNFjt5bc,5979
163
+ onnxscript/tools/transformers_models/mistral.py,sha256=3guJ9uWhugB54lJOFmeiA-fTJqbnQkjzTEHD3UZ6YqA,7935
164
+ onnxscript/tools/transformers_models/phi.py,sha256=AQWUZBuNFpngQ_u3IrZ3p5obVuY_BV522qellxcIDH4,8352
165
+ onnxscript/tools/transformers_models/phi3.py,sha256=mZAUAf--jjWPQK7NsELhdctZTuWbXjzVQQSrcIu61BQ,8417
166
+ onnxscript/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
167
+ onnxscript/utils/evaluation_utils.py,sha256=9zaNOt5p9M5DOsnuKzjuKzpJaX_yiioXMbqfsKqyQac,2312
168
+ onnxscript/utils/timing_utils.py,sha256=X9fQRO364EoSfPW_N_RkFsOoTM0LBdLyjYNK4qawNGk,730
169
+ onnxscript/utils/utils.py,sha256=GwlLynq87ZSQg5VZvb-pPIKHb-yr4j2LariyMOsBN8o,2578
170
+ onnxscript/version_converter/__init__.py,sha256=u9AbpQF9f6wImXIADJjkwpaIXVTbt9pVNZ9Y9-eq2vA,665
171
+ onnxscript/version_converter/_version_converter.py,sha256=ajKbRKm1Iwl_ApblJ4yMDVDtOeTESjiHqUU_RmV0rpY,11083
172
+ onnxscript-0.1.0.dist-info/LICENSE,sha256=LwfHJ1Gu2ZeQuKSGnPIxHfhahgsi3tBfoigDWHpIkiw,1073
173
+ onnxscript-0.1.0.dist-info/METADATA,sha256=DFPmpyhAN2WqHQ4y5kVLTGerFo4M6mMRRL_YjiOSa7I,15014
174
+ onnxscript-0.1.0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
175
+ onnxscript-0.1.0.dist-info/top_level.txt,sha256=EHA6EtRwoTj6gey-giqArKPQJdVEgQNWGkPAsKyAySQ,11
176
+ onnxscript-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (75.8.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ onnxscript