onnxscript 0.7.2.dev20260711__tar.gz → 0.7.2.dev20260725__tar.gz
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.
- {onnxscript-0.7.2.dev20260711/onnxscript.egg-info → onnxscript-0.7.2.dev20260725}/PKG-INFO +2 -2
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/core.py +141 -17
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/__init__.py +2 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/__init__.py +4 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_basic_rules.py +2 -1
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_collapse_slices.py +6 -1
- onnxscript-0.7.2.dev20260725/onnxscript/rewriter/rules/common/_materialize_reshape_shape.py +63 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725/onnxscript.egg-info}/PKG-INFO +2 -2
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript.egg-info/SOURCES.txt +1 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/LICENSE +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/MANIFEST.in +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/README.md +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/VERSION +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/torch_2_11.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/torch_2_5.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/torch_2_6.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/torch_2_7.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/torch_2_8.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/torch_2_9.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/_inference.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/_inliner.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/analysis.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/ast_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/autocast.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/builder.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/converter.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/deprecation.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/evaluator.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/irbuilder.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/main.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/param_manipulation.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/sourceinfo.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/tape_builder.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/type_annotation.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/values.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/version_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/backend/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/backend/onnx_backend.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/backend/onnx_export.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/evaluator.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/tools/torch_lib/deduce_type_constraints.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/tools/torch_lib/generate_aten_signatures.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/tools/torch_lib/generate_prims_signatures.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/_constants.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/_flags.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/graph_building/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/common.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/fft.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/linalg.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/nested.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/nn.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/prims.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/quantized_decomposed.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/sparse.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/special.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/ops/vision.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/registration.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/function_libs/torch_lib/tensor_typing.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/ir/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/ir/_schemas.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/ir/convenience.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/ir/passes/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/ir/passes/common/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/nn/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/nn/_module.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/nn/_module_list.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/nn/_parameter.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/nn/_sequential.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset1.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset10.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset11.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset12.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset13.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset14.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset15.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset16.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset17.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset18.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset19.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset2.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset20.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset21.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset22.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset23.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset24.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset25.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset26.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset27.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset3.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset4.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset5.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset6.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset7.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset8.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset9.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset_ai_onnx_ml1.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset_ai_onnx_ml2.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset_ai_onnx_ml3.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset_ai_onnx_ml4.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset_ai_onnx_ml5.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset_ai_onnx_preview1.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_types.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/optimizer/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/optimizer/_constant_folding.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/optimizer/_optimizer.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/py.typed +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/_basics.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/_context.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/_fusion_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/_ir_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/_matcher.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/_pattern_ir.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/_rewrite_rule.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_bart_encoder.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_phi2lm.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_phi4lm.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_rotary_embedding_models.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_smollm_1.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_smollm_2.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_test_models.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_whisper_decoder.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/models/_whisper_encoder.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/onnx_fusions/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/onnx_fusions/_onnx_fusions.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/onnxruntime/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/onnxruntime/bfloat16_utils/bfloat16_converter.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/_core.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/_test_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/attention.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/bias_gelu.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/cos_sin_cache.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/erfgelu.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/fused_matmul_rule_sets.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/gelu.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/gqa.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/gqa_packed_qkv.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/group_normalization_merge_silu.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/instance_to_group_normalization.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/mha.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/mha_bias.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/mha_scale.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/rms_normalization.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/rotary_embedding.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/sdpa.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/sdpa_via_mha.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/shape_optimization.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/skip_normalization.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/ort_fusions/softmax.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/pattern.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_broadcast_to_matmul.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_cast_constant_of_shape.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_fuse_batchnorm.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_fuse_conv_affine.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_fuse_hardswish.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_fuse_pad_into_conv.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_fuse_relus_clips.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_gemm_to_matmul_add.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_matmul_add_to_gemm.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_min_max_to_clip.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_no_op.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_redundant_scatter_nd.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_remove_expand_before_binary_op.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/common/_remove_optional_bias.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/fusion/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/fusion/_gqa.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/fusion/_layer_norm.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/fusion/_rms_normalization.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/rules/fusion/_rotary_embedding.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/testing.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tensor.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/testing/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tools/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tools/memory_peak.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tools/transformers_models/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tools/transformers_models/llama.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tools/transformers_models/mistral.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tools/transformers_models/phi.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/tools/transformers_models/phi3.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/utils/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/utils/evaluation_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/utils/metadata_merger.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/utils/replace.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/utils/timing_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/utils/utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/values.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/version_converter/__init__.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/version_converter/_c_api_utils.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/version_converter/_version_converter.py +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript.egg-info/dependency_links.txt +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript.egg-info/requires.txt +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript.egg-info/top_level.txt +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/pyproject.toml +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/setup.cfg +0 -0
- {onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onnxscript
|
|
3
|
-
Version: 0.7.2.
|
|
3
|
+
Version: 0.7.2.dev20260725
|
|
4
4
|
Summary: Naturally author ONNX functions and models using a subset of Python
|
|
5
5
|
Author-email: Microsoft Corporation <onnx@microsoft.com>
|
|
6
6
|
License: MIT License
|
|
@@ -27,7 +27,7 @@ License: MIT License
|
|
|
27
27
|
|
|
28
28
|
Project-URL: Homepage, https://microsoft.github.io/onnxscript/
|
|
29
29
|
Project-URL: Repository, https://github.com/microsoft/onnxscript
|
|
30
|
-
Project-URL: Commit, https://github.com/microsoft/onnxscript/tree/
|
|
30
|
+
Project-URL: Commit, https://github.com/microsoft/onnxscript/tree/9ef0aacc95410a68d92668690a98cc6636b9aa13
|
|
31
31
|
Classifier: Development Status :: 4 - Beta
|
|
32
32
|
Classifier: Environment :: Console
|
|
33
33
|
Classifier: Intended Audience :: Developers
|
|
@@ -1254,12 +1254,41 @@ def aten_binary_cross_entropy_with_logits(
|
|
|
1254
1254
|
raise NotImplementedError()
|
|
1255
1255
|
|
|
1256
1256
|
|
|
1257
|
+
@torch_op("aten::bincount", trace_only=True)
|
|
1257
1258
|
def aten_bincount(
|
|
1258
|
-
self:
|
|
1259
|
+
self: IntType, weights: Optional[TensorType] = None, minlength: int = 0
|
|
1259
1260
|
) -> TensorType:
|
|
1260
|
-
"""bincount(Tensor self, Tensor? weights=None, int minlength=0) -> Tensor
|
|
1261
|
+
"""bincount(Tensor self, Tensor? weights=None, int minlength=0) -> Tensor
|
|
1261
1262
|
|
|
1262
|
-
|
|
1263
|
+
``weights`` is not supported. Negative inputs are rejected by torch and are not
|
|
1264
|
+
handled here (ONNX integer ops would wrap them around).
|
|
1265
|
+
"""
|
|
1266
|
+
if weights is not None:
|
|
1267
|
+
raise NotImplementedError("aten::bincount with weights is not supported.")
|
|
1268
|
+
|
|
1269
|
+
self = op.Cast(self, to=INT64.dtype)
|
|
1270
|
+
axis_0 = op.Constant(value_ints=[0])
|
|
1271
|
+
# Append a 0 so ReduceMax is defined even when ``self`` is empty. It only sizes the
|
|
1272
|
+
# output and never contributes to the counts (the scatter below uses ``self``).
|
|
1273
|
+
data_max = op.Unsqueeze(
|
|
1274
|
+
op.ReduceMax(op.Concat(self, op.Constant(value_ints=[0]), axis=0), keepdims=0),
|
|
1275
|
+
axis_0,
|
|
1276
|
+
)
|
|
1277
|
+
# An empty input yields depth 0, so the output is empty unless ``minlength`` applies.
|
|
1278
|
+
non_empty = op.Unsqueeze(
|
|
1279
|
+
op.Cast(op.Greater(op.Size(self), op.Constant(value_int=0)), to=INT64.dtype),
|
|
1280
|
+
axis_0,
|
|
1281
|
+
)
|
|
1282
|
+
depth = op.Mul(op.Add(data_max, op.Constant(value_ints=[1])), non_empty)
|
|
1283
|
+
if minlength > 0:
|
|
1284
|
+
depth = op.Max(depth, op.Constant(value_ints=[minlength]))
|
|
1285
|
+
|
|
1286
|
+
# Scatter-add 1 for each value into a zero vector of length ``depth``. This uses
|
|
1287
|
+
# O(N + depth) memory instead of the dense O(N * depth) one-hot, and behaves
|
|
1288
|
+
# correctly for empty inputs.
|
|
1289
|
+
zeros = op.Expand(op.Constant(value_int=0), depth)
|
|
1290
|
+
ones = op.Expand(op.Constant(value_int=1), op.Shape(self))
|
|
1291
|
+
return op.ScatterElements(zeros, self, ones, axis=0, reduction="add")
|
|
1263
1292
|
|
|
1264
1293
|
|
|
1265
1294
|
def aten_binomial(
|
|
@@ -2276,6 +2305,29 @@ def aten_convolution(
|
|
|
2276
2305
|
return result
|
|
2277
2306
|
|
|
2278
2307
|
|
|
2308
|
+
def _conv_kernel_shape(weight: TFloat, complex: bool = False) -> Optional[Sequence[int]]:
|
|
2309
|
+
"""Return the spatial (kernel) shape of the convolution weight if statically known.
|
|
2310
|
+
|
|
2311
|
+
The kernel_shape attribute of ONNX Conv/ConvTranspose corresponds to the spatial
|
|
2312
|
+
dimensions of the weight tensor, i.e. all dimensions except the leading two
|
|
2313
|
+
(output and input channels). When ``complex`` is True, the weight has a trailing
|
|
2314
|
+
dimension of size 2 (real/imaginary parts) which is also excluded. Returns None
|
|
2315
|
+
when the spatial shape is not fully static, in which case the attribute is omitted
|
|
2316
|
+
and inferred by ONNX.
|
|
2317
|
+
"""
|
|
2318
|
+
shape = weight.shape
|
|
2319
|
+
if shape is None:
|
|
2320
|
+
return None
|
|
2321
|
+
# Exclude the leading output/input channel dims, and for complex weights the
|
|
2322
|
+
# trailing real/imag dim as well.
|
|
2323
|
+
kernel_shape = shape[2:-1] if complex else shape[2:]
|
|
2324
|
+
if len(kernel_shape) == 0:
|
|
2325
|
+
return None
|
|
2326
|
+
if any(not isinstance(dim, int) for dim in kernel_shape):
|
|
2327
|
+
return None
|
|
2328
|
+
return list(kernel_shape)
|
|
2329
|
+
|
|
2330
|
+
|
|
2279
2331
|
def _aten_convolution_onnx(
|
|
2280
2332
|
input: TFloat,
|
|
2281
2333
|
weight: TFloat,
|
|
@@ -2299,6 +2351,11 @@ def _aten_convolution_onnx(
|
|
|
2299
2351
|
if no_batch:
|
|
2300
2352
|
input = op.Unsqueeze(input, op.Constant(value_ints=[0]))
|
|
2301
2353
|
|
|
2354
|
+
# kernel_shape is the spatial shape of the weight tensor (excluding the
|
|
2355
|
+
# output-channel and input-channel dimensions). It is optional in the ONNX
|
|
2356
|
+
# spec but is set explicitly here to match the ONNX Conv specification.
|
|
2357
|
+
kernel_shape = _conv_kernel_shape(weight)
|
|
2358
|
+
|
|
2302
2359
|
if transposed:
|
|
2303
2360
|
result = op.ConvTranspose(
|
|
2304
2361
|
input,
|
|
@@ -2309,6 +2366,7 @@ def _aten_convolution_onnx(
|
|
|
2309
2366
|
group=groups,
|
|
2310
2367
|
dilations=dilations,
|
|
2311
2368
|
output_padding=output_padding,
|
|
2369
|
+
kernel_shape=kernel_shape,
|
|
2312
2370
|
)
|
|
2313
2371
|
else:
|
|
2314
2372
|
result = op.Conv(
|
|
@@ -2319,6 +2377,7 @@ def _aten_convolution_onnx(
|
|
|
2319
2377
|
pads=pads,
|
|
2320
2378
|
group=groups,
|
|
2321
2379
|
dilations=dilations,
|
|
2380
|
+
kernel_shape=kernel_shape,
|
|
2322
2381
|
)
|
|
2323
2382
|
|
|
2324
2383
|
if no_batch:
|
|
@@ -2358,6 +2417,11 @@ def _aten_convolution_complex_onnx(
|
|
|
2358
2417
|
bias_imag = op.Gather(bias, 1, axis=-1)
|
|
2359
2418
|
bias_zero = op.Expand(op.CastLike(0.0, weight), op.Shape(bias_real))
|
|
2360
2419
|
|
|
2420
|
+
# The complex weight has a trailing dimension of size 2 (real/imaginary parts),
|
|
2421
|
+
# so the spatial (kernel) shape excludes both leading channel dimensions and the
|
|
2422
|
+
# trailing complex dimension.
|
|
2423
|
+
kernel_shape = _conv_kernel_shape(weight, complex=True)
|
|
2424
|
+
|
|
2361
2425
|
if transposed:
|
|
2362
2426
|
result_real = op.Sub(
|
|
2363
2427
|
op.ConvTranspose(
|
|
@@ -2369,6 +2433,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2369
2433
|
group=groups,
|
|
2370
2434
|
dilations=dilations,
|
|
2371
2435
|
output_padding=output_padding,
|
|
2436
|
+
kernel_shape=kernel_shape,
|
|
2372
2437
|
),
|
|
2373
2438
|
op.ConvTranspose(
|
|
2374
2439
|
input_imag,
|
|
@@ -2379,6 +2444,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2379
2444
|
group=groups,
|
|
2380
2445
|
dilations=dilations,
|
|
2381
2446
|
output_padding=output_padding,
|
|
2447
|
+
kernel_shape=kernel_shape,
|
|
2382
2448
|
),
|
|
2383
2449
|
)
|
|
2384
2450
|
result_imag = op.Add(
|
|
@@ -2391,6 +2457,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2391
2457
|
group=groups,
|
|
2392
2458
|
dilations=dilations,
|
|
2393
2459
|
output_padding=output_padding,
|
|
2460
|
+
kernel_shape=kernel_shape,
|
|
2394
2461
|
),
|
|
2395
2462
|
op.ConvTranspose(
|
|
2396
2463
|
input_imag,
|
|
@@ -2401,6 +2468,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2401
2468
|
group=groups,
|
|
2402
2469
|
dilations=dilations,
|
|
2403
2470
|
output_padding=output_padding,
|
|
2471
|
+
kernel_shape=kernel_shape,
|
|
2404
2472
|
),
|
|
2405
2473
|
)
|
|
2406
2474
|
else:
|
|
@@ -2413,6 +2481,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2413
2481
|
pads=pads,
|
|
2414
2482
|
group=groups,
|
|
2415
2483
|
dilations=dilations,
|
|
2484
|
+
kernel_shape=kernel_shape,
|
|
2416
2485
|
),
|
|
2417
2486
|
op.Conv(
|
|
2418
2487
|
input_imag,
|
|
@@ -2422,6 +2491,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2422
2491
|
pads=pads,
|
|
2423
2492
|
group=groups,
|
|
2424
2493
|
dilations=dilations,
|
|
2494
|
+
kernel_shape=kernel_shape,
|
|
2425
2495
|
),
|
|
2426
2496
|
)
|
|
2427
2497
|
|
|
@@ -2434,6 +2504,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2434
2504
|
pads=pads,
|
|
2435
2505
|
group=groups,
|
|
2436
2506
|
dilations=dilations,
|
|
2507
|
+
kernel_shape=kernel_shape,
|
|
2437
2508
|
),
|
|
2438
2509
|
op.Conv(
|
|
2439
2510
|
input_imag,
|
|
@@ -2443,6 +2514,7 @@ def _aten_convolution_complex_onnx(
|
|
|
2443
2514
|
pads=pads,
|
|
2444
2515
|
group=groups,
|
|
2445
2516
|
dilations=dilations,
|
|
2517
|
+
kernel_shape=kernel_shape,
|
|
2446
2518
|
),
|
|
2447
2519
|
)
|
|
2448
2520
|
|
|
@@ -4983,8 +5055,14 @@ def aten_index_put(
|
|
|
4983
5055
|
# will invalidate equality-based check.
|
|
4984
5056
|
first_shape = indices[advanced_indices[0]].shape
|
|
4985
5057
|
|
|
4986
|
-
def same_shape(other_shape: ir.Shape) -> bool:
|
|
4987
|
-
return (
|
|
5058
|
+
def same_shape(other_shape: Optional[ir.Shape]) -> bool:
|
|
5059
|
+
return (
|
|
5060
|
+
first_shape is not None
|
|
5061
|
+
and other_shape is not None
|
|
5062
|
+
and not any(d is None for d in first_shape)
|
|
5063
|
+
and not any(d is None for d in other_shape)
|
|
5064
|
+
and other_shape == first_shape
|
|
5065
|
+
)
|
|
4988
5066
|
|
|
4989
5067
|
all_same_shape = all(same_shape(indices[i].shape) for i in advanced_indices)
|
|
4990
5068
|
if not all_same_shape:
|
|
@@ -5078,24 +5156,70 @@ def aten_index_put(
|
|
|
5078
5156
|
|
|
5079
5157
|
def _aten_index_put_bool(
|
|
5080
5158
|
self: TReal,
|
|
5081
|
-
indices: Sequence[BOOL],
|
|
5159
|
+
indices: Sequence[Optional[Union[INT64, BOOL]]],
|
|
5082
5160
|
values: TReal,
|
|
5083
5161
|
accumulate: bool = False,
|
|
5084
5162
|
) -> TReal:
|
|
5085
5163
|
"""index_put(Tensor self, Tensor?[] indices, Tensor values, bool accumulate=False) -> Tensor"""
|
|
5086
5164
|
|
|
5087
|
-
|
|
5088
|
-
|
|
5089
|
-
|
|
5090
|
-
|
|
5165
|
+
bool_mask = indices[0]
|
|
5166
|
+
if len(indices) > 1:
|
|
5167
|
+
if any(index is None for index in indices):
|
|
5168
|
+
raise NotImplementedError(
|
|
5169
|
+
"Boolean index_put with multiple indices does not support None indices."
|
|
5170
|
+
)
|
|
5171
|
+
|
|
5172
|
+
advanced_indices = []
|
|
5173
|
+
selected_positions = []
|
|
5174
|
+
minus_one = op.Constant(value_ints=[-1])
|
|
5175
|
+
for index in indices:
|
|
5176
|
+
if index.dtype != BOOL.dtype or len(index.shape) != 1:
|
|
5177
|
+
raise NotImplementedError(
|
|
5178
|
+
"Boolean index_put with multiple indices supports only 1-D boolean masks."
|
|
5179
|
+
)
|
|
5180
|
+
positions = op.Reshape(op.Transpose(op.NonZero(index), perm=[1, 0]), minus_one)
|
|
5181
|
+
selected_positions.append(positions)
|
|
5182
|
+
advanced_indices.append(op.Unsqueeze(positions, minus_one))
|
|
5183
|
+
onnx_index = op.Concat(*advanced_indices, axis=-1)
|
|
5184
|
+
target_shape = op.Concat(
|
|
5185
|
+
op.Shape(selected_positions[0]),
|
|
5186
|
+
op.Slice(op.Shape(self), starts=[len(indices)], ends=[len(self.shape)], axes=[0]),
|
|
5187
|
+
axis=0,
|
|
5188
|
+
)
|
|
5189
|
+
expanded_values = op.Expand(values, target_shape)
|
|
5190
|
+
return op.ScatterND(
|
|
5191
|
+
self, onnx_index, expanded_values, reduction="add" if accumulate else None
|
|
5192
|
+
)
|
|
5193
|
+
|
|
5194
|
+
if bool_mask is None or bool_mask.dtype != BOOL.dtype:
|
|
5195
|
+
raise NotImplementedError(
|
|
5196
|
+
"Boolean index_put expects a boolean mask as the first index."
|
|
5197
|
+
)
|
|
5198
|
+
|
|
5199
|
+
neg_1 = op.Constant(value_ints=[-1])
|
|
5091
5200
|
self_rank = len(self.shape)
|
|
5092
|
-
|
|
5093
|
-
|
|
5094
|
-
|
|
5095
|
-
|
|
5096
|
-
|
|
5097
|
-
|
|
5098
|
-
|
|
5201
|
+
mask_rank = len(bool_mask.shape)
|
|
5202
|
+
|
|
5203
|
+
# Expand a lower-rank mask (e.g. a row mask) across the trailing dimensions of self
|
|
5204
|
+
# so it selects whole slices, then collect the coordinates of every selected element.
|
|
5205
|
+
# NonZero returns them in row-major order.
|
|
5206
|
+
expanded_mask = bool_mask
|
|
5207
|
+
for _ in range(self_rank - mask_rank):
|
|
5208
|
+
expanded_mask = op.Unsqueeze(expanded_mask, neg_1)
|
|
5209
|
+
expanded_mask = op.Expand(expanded_mask, op.Shape(self))
|
|
5210
|
+
selected_indices = op.Transpose(op.NonZero(expanded_mask), perm=[1, 0])
|
|
5211
|
+
|
|
5212
|
+
# Broadcast ``values`` to the selection shape ``[num_true, *self.shape[mask_rank:]]``
|
|
5213
|
+
# and flatten it to one update per selected element. This keeps scalar and
|
|
5214
|
+
# broadcastable ``values`` working, matching ``self[mask] = values`` semantics.
|
|
5215
|
+
num_true = op.ReduceSum(op.Cast(op.Reshape(bool_mask, neg_1), to=INT64.dtype), keepdims=1)
|
|
5216
|
+
trailing_shape = op.Slice(op.Shape(self), starts=[mask_rank], ends=[self_rank], axes=[0])
|
|
5217
|
+
selection_shape = op.Concat(num_true, trailing_shape, axis=0)
|
|
5218
|
+
flat_values = op.Reshape(op.Expand(values, selection_shape), neg_1)
|
|
5219
|
+
|
|
5220
|
+
return op.ScatterND(
|
|
5221
|
+
self, selected_indices, flat_values, reduction="add" if accumulate else None
|
|
5222
|
+
)
|
|
5099
5223
|
|
|
5100
5224
|
|
|
5101
5225
|
def aten_index_reduce(
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/rewriter/__init__.py
RENAMED
|
@@ -43,6 +43,7 @@ from onnxscript.rewriter.rules.common import (
|
|
|
43
43
|
_fuse_batchnorm,
|
|
44
44
|
_fuse_pad_into_conv,
|
|
45
45
|
_fuse_relus_clips,
|
|
46
|
+
_materialize_reshape_shape,
|
|
46
47
|
_min_max_to_clip,
|
|
47
48
|
_no_op,
|
|
48
49
|
_redundant_scatter_nd,
|
|
@@ -57,6 +58,7 @@ _DEFAULT_REWRITE_RULES: tuple[pattern.RewriteRule, ...] = (
|
|
|
57
58
|
*_broadcast_to_matmul.rules,
|
|
58
59
|
*_cast_constant_of_shape.rules,
|
|
59
60
|
*_collapse_slices.rules,
|
|
61
|
+
*_materialize_reshape_shape.rules,
|
|
60
62
|
*_min_max_to_clip.rules,
|
|
61
63
|
*_fuse_relus_clips.rules,
|
|
62
64
|
*_basic_rules.basic_optimization_rules(),
|
|
@@ -26,6 +26,7 @@ __all__ = [
|
|
|
26
26
|
"max_min_rule",
|
|
27
27
|
"gemm_to_matmul_add_rule",
|
|
28
28
|
"matmul_add_to_gemm_rule",
|
|
29
|
+
"materialize_reshape_shape_rule",
|
|
29
30
|
"mul_by_1_rule",
|
|
30
31
|
"no_op_cast_rule",
|
|
31
32
|
"no_op_dynamic_scatter_nd_rule",
|
|
@@ -102,6 +103,9 @@ from onnxscript.rewriter.rules.common._fuse_relus_clips import (
|
|
|
102
103
|
successive_relu_rule,
|
|
103
104
|
)
|
|
104
105
|
from onnxscript.rewriter.rules.common._gemm_to_matmul_add import gemm_to_matmul_add_rule
|
|
106
|
+
from onnxscript.rewriter.rules.common._materialize_reshape_shape import (
|
|
107
|
+
materialize_reshape_shape_rule,
|
|
108
|
+
)
|
|
105
109
|
from onnxscript.rewriter.rules.common._matmul_add_to_gemm import (
|
|
106
110
|
matmul_add_to_gemm_rule,
|
|
107
111
|
transpose_a_matmul_add_to_gemm_rule,
|
|
@@ -125,7 +125,7 @@ class ReshapeReshape(RewriteRuleClassBase):
|
|
|
125
125
|
return op.Reshape(op.Reshape(x, shape_ignored), shape)
|
|
126
126
|
|
|
127
127
|
def rewrite(self, op, x: ir.Value, shape_ignored: ir.Value, shape: ir.Value):
|
|
128
|
-
new_shape = op.initializer(ir.Tensor(self._new_shape, name=
|
|
128
|
+
new_shape = op.initializer(ir.Tensor(self._new_shape, name=self._new_shape_name))
|
|
129
129
|
return op.Reshape(x, new_shape, allowzero=self._allowzero)
|
|
130
130
|
|
|
131
131
|
def check(self, context, x, shape_ignored, shape) -> MatchResult:
|
|
@@ -145,6 +145,7 @@ class ReshapeReshape(RewriteRuleClassBase):
|
|
|
145
145
|
|
|
146
146
|
# Constraints for shape.
|
|
147
147
|
self._allowzero = context.nodes[0].attributes.get_int("allowzero", 0)
|
|
148
|
+
self._new_shape_name = f"{context.output_values[0].name}/shape"
|
|
148
149
|
if self._allowzero == 1 and any(self._new_shape == 0):
|
|
149
150
|
return check_result
|
|
150
151
|
if any(self._new_shape == 0) and any(self._new_shape < 0):
|
|
@@ -82,7 +82,12 @@ def _same_shape(op, data: ir.Value, slice_output: ir.Value, steps: ir.Value, **_
|
|
|
82
82
|
if data.shape is None or slice_output.shape is None:
|
|
83
83
|
return False
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
# All steps must be 1
|
|
86
|
+
steps_np = _ir_utils.get_numpy_value(steps)
|
|
87
|
+
if steps_np is not None:
|
|
88
|
+
if not all(s == 1 for s in steps_np.flat):
|
|
89
|
+
return False
|
|
90
|
+
elif not _ir_utils.is_singleton_value(steps, 1):
|
|
86
91
|
return False
|
|
87
92
|
|
|
88
93
|
return _ir_utils.same_shape(data.shape, slice_output.shape)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
# Copyright (c) Microsoft Corporation.
|
|
2
|
+
# Licensed under the MIT License.
|
|
3
|
+
"""Materialize Reshape shape input from known output shape.
|
|
4
|
+
|
|
5
|
+
When symbolic shape inference has been run, a Reshape node may have a known
|
|
6
|
+
output shape even though its shape input is computed dynamically (e.g., via a
|
|
7
|
+
Shape → Cast → Split → Concat chain). This rule replaces the shape input
|
|
8
|
+
with a concrete constant, allowing the dynamic chain to become dead code and
|
|
9
|
+
be removed by unused-node elimination.
|
|
10
|
+
|
|
11
|
+
- Fully static output shape → constant with exact dims.
|
|
12
|
+
- Exactly one symbolic dim → replace it with ``-1`` (Reshape infers it).
|
|
13
|
+
"""
|
|
14
|
+
|
|
15
|
+
from __future__ import annotations
|
|
16
|
+
|
|
17
|
+
from onnxscript import ir
|
|
18
|
+
from onnxscript.rewriter import _ir_utils as ir_utils
|
|
19
|
+
from onnxscript.rewriter._basics import MatchResult
|
|
20
|
+
from onnxscript.rewriter._rewrite_rule import RewriteRuleClassBase, RewriteRuleSet
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
class MaterializeReshapeShape(RewriteRuleClassBase):
|
|
24
|
+
"""Replace a dynamic Reshape shape input with a constant when output shape is known."""
|
|
25
|
+
|
|
26
|
+
def pattern(self, op, data, shape):
|
|
27
|
+
return op.Reshape(data, shape)
|
|
28
|
+
|
|
29
|
+
def check(self, context, data: ir.Value, shape: ir.Value) -> MatchResult:
|
|
30
|
+
check_result = MatchResult()
|
|
31
|
+
|
|
32
|
+
# Shape input must not already be a constant
|
|
33
|
+
if ir_utils.get_numpy_value(shape) is not None:
|
|
34
|
+
return check_result.fail("Shape input is already a constant.")
|
|
35
|
+
|
|
36
|
+
output = context.output_values[0]
|
|
37
|
+
if output.shape is None:
|
|
38
|
+
return check_result.fail("Output shape is not known.")
|
|
39
|
+
|
|
40
|
+
dims = list(output.shape)
|
|
41
|
+
sym_count = sum(1 for d in dims if not isinstance(d, int))
|
|
42
|
+
|
|
43
|
+
if sym_count <= 1:
|
|
44
|
+
self._new_dims = [-1 if not isinstance(d, int) else int(d) for d in dims]
|
|
45
|
+
else:
|
|
46
|
+
return check_result.fail(
|
|
47
|
+
f"Output shape has {sym_count} symbolic dims, cannot materialize."
|
|
48
|
+
)
|
|
49
|
+
|
|
50
|
+
return check_result
|
|
51
|
+
|
|
52
|
+
def rewrite(self, op, data: ir.Value, shape: ir.Value):
|
|
53
|
+
new_shape = op.Constant(
|
|
54
|
+
value=ir.tensor(self._new_dims, dtype=ir.DataType.INT64),
|
|
55
|
+
)
|
|
56
|
+
# Use allowzero=1 because the materialized dims are concrete values
|
|
57
|
+
# from shape inference, so a 0 dim means "actually zero" not "copy from input"
|
|
58
|
+
return op.Reshape(data, new_shape, allowzero=1)
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
materialize_reshape_shape_rule = MaterializeReshapeShape.rule()
|
|
62
|
+
|
|
63
|
+
rules = RewriteRuleSet([materialize_reshape_shape_rule])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: onnxscript
|
|
3
|
-
Version: 0.7.2.
|
|
3
|
+
Version: 0.7.2.dev20260725
|
|
4
4
|
Summary: Naturally author ONNX functions and models using a subset of Python
|
|
5
5
|
Author-email: Microsoft Corporation <onnx@microsoft.com>
|
|
6
6
|
License: MIT License
|
|
@@ -27,7 +27,7 @@ License: MIT License
|
|
|
27
27
|
|
|
28
28
|
Project-URL: Homepage, https://microsoft.github.io/onnxscript/
|
|
29
29
|
Project-URL: Repository, https://github.com/microsoft/onnxscript
|
|
30
|
-
Project-URL: Commit, https://github.com/microsoft/onnxscript/tree/
|
|
30
|
+
Project-URL: Commit, https://github.com/microsoft/onnxscript/tree/9ef0aacc95410a68d92668690a98cc6636b9aa13
|
|
31
31
|
Classifier: Development Status :: 4 - Beta
|
|
32
32
|
Classifier: Environment :: Console
|
|
33
33
|
Classifier: Intended Audience :: Developers
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript.egg-info/SOURCES.txt
RENAMED
|
@@ -170,6 +170,7 @@ onnxscript/rewriter/rules/common/_fuse_hardswish.py
|
|
|
170
170
|
onnxscript/rewriter/rules/common/_fuse_pad_into_conv.py
|
|
171
171
|
onnxscript/rewriter/rules/common/_fuse_relus_clips.py
|
|
172
172
|
onnxscript/rewriter/rules/common/_gemm_to_matmul_add.py
|
|
173
|
+
onnxscript/rewriter/rules/common/_materialize_reshape_shape.py
|
|
173
174
|
onnxscript/rewriter/rules/common/_matmul_add_to_gemm.py
|
|
174
175
|
onnxscript/rewriter/rules/common/_min_max_to_clip.py
|
|
175
176
|
onnxscript/rewriter/rules/common/_no_op.py
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_framework_apis/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/__init__.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/_inference.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/_inliner.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/analysis.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/ast_utils.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/autocast.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/builder.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/converter.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/deprecation.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/evaluator.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/irbuilder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/sourceinfo.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/tape_builder.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/values.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/_internal/version_utils.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/backend/__init__.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/backend/onnx_backend.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/backend/onnx_export.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/ir/passes/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/__init__.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset1.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset10.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset11.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset12.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset13.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset14.py
RENAMED
|
File without changes
|
{onnxscript-0.7.2.dev20260711 → onnxscript-0.7.2.dev20260725}/onnxscript/onnx_opset/_impl/opset15.py
RENAMED
|
File without changes
|