Skip to content

Conversation

@Honry
Copy link
Contributor

@Honry Honry commented Oct 23, 2025

ONNX Softmax operates with different semantics before and after opset 13. Before opset 13, it normalizes over the flattened range of dimensions starting from axis to the last dimension. Fix it by reshaping the input to [M, N] where M = prod(d0..d{axis-1}) and N = prod(d{axis-1}..d{n-1}) and applying softmax along N, then reshaping back to the original shape.

ONNX Softmax operates with different semantics before and after opset 13.
Before opset 13, it normalizes over the flattened range of dimensions
starting from axis to the last dimension. Fix it by reshaping the input
to [M, N] where M = prod(d0..d{axis-1}) and N = prod(d{axis-1}..d{n-1})
and apply softmax along N, then reshaping back to the original shape.
@Honry
Copy link
Contributor Author

Honry commented Oct 23, 2025

@fdwr, @guschmue, PTAL, thanks!

@guschmue guschmue added the ep:WebNN WebNN execution provider label Oct 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ep:WebNN WebNN execution provider

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants