Skip to content

fixed matmul broadcasting #25663

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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"

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