Skip to content

Conversation

konstantin-pueckler-qc
Copy link

@konstantin-pueckler-qc konstantin-pueckler-qc commented Aug 6, 2025

Description

currently, the broadcasting of the MatMul operator does not correctly handle zero-sized batch dimensions. By the numpy standard, when one matrix has length 0 in one batch dimension and the other matrix has length 1 in that dimension, it should be broadcasted to length 0. Instead, onnxruntime currently raises an error in that case.
I modified the computation of output_dims to fix that error.

Motivation and Context

We came across this problem when testing the onnxruntime via onnx-tests.

Signed-off-by: Konstantin Pueckler <[email protected]>
@konstantin-pueckler-qc
Copy link
Author

@microsoft-github-policy-service agree company="QuantCo"

@konstantin-pueckler-qc
Copy link
Author

@xadupre might you be in a position to review this?

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