Skip to content

[Shape Inference] Add shape inference for MatMulIntegerToFloat op - #31199

Open
roberto-laudani wants to merge 1 commit into
microsoft:mainfrom
roberto-laudani:symbolic-shape-infer-matmulintegertofloat
Open

[Shape Inference] Add shape inference for MatMulIntegerToFloat op#31199
roberto-laudani wants to merge 1 commit into
microsoft:mainfrom
roberto-laudani:symbolic-shape-infer-matmulintegertofloat

Conversation

@roberto-laudani

Copy link
Copy Markdown

Description

Add a shape inference rule for MatMulIntegerToFloat to symbolic_shape_infer.py. The output type comes from a_scale and the shape from the first two inputs, same as the op's schema does.

Motivation and Context

MatMulIntegerToFloat is a com.microsoft op, so onnx.shape_inference cannot infer it on its own. Without a rule the output type stays UNDEFINED. infer_shapes() then stops at the first MatMulIntegerToFloat node and raises Incomplete symbolic shape inference.

### Description

Add a `MatMulIntegerToFloat` rule to the `SymbolicShapeInference` dispatcher,
mirroring the type and shape inference function registered for the op's schema:
the output element type is propagated from `a_scale` and the output shape is the
matmul shape of the first two inputs.

### Motivation and Context

`MatMulIntegerToFloat` is defined in the `com.microsoft` domain, so
`onnx.shape_inference` cannot infer it and `symbolic_shape_infer.py` has to
supply the rule. Without a dispatcher entry its output keeps an `UNDEFINED`
element type and `infer_shapes()` raises `Incomplete symbolic shape inference`
for the whole model at the first such node. Same class of gap as microsoft#21246
(MatMulNBits) and microsoft#24090 (QLinearAdd/QLinearMul).
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
There may be pipelines that require an authorized user to comment /azp run to run.

@roberto-laudani

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant