Skip to content

fixed handling of empty inputs for the softmax operator#7206

Merged
justinchuby merged 1 commit intoonnx:mainfrom
konstantin-pueckler-qc:fix_softmax_empty_input
Aug 6, 2025
Merged

fixed handling of empty inputs for the softmax operator#7206
justinchuby merged 1 commit intoonnx:mainfrom
konstantin-pueckler-qc:fix_softmax_empty_input

Conversation

@konstantin-pueckler-qc
Copy link
Copy Markdown
Contributor

Description

When given an empty input, softmax should return an output of the same shape. Currently, an exception is raised by X.max in that case.

Motivation and Context

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

Signed-off-by: Konstantin Pueckler <konstantin.pueckler@quantco.com>
@konstantin-pueckler-qc konstantin-pueckler-qc requested a review from a team as a code owner August 6, 2025 12:27
@github-project-automation github-project-automation Bot moved this to In progress in PR Tracker Aug 6, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 6, 2025

Codecov Report

❌ Patch coverage is 0% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 53.75%. Comparing base (6823501) to head (5d96f52).
⚠️ Report is 145 commits behind head on main.

Files with missing lines Patch % Lines
onnx/reference/ops/op_softmax.py 0.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7206      +/-   ##
==========================================
- Coverage   53.76%   53.75%   -0.01%     
==========================================
  Files         512      512              
  Lines       32199    32201       +2     
  Branches     2944     2945       +1     
==========================================
  Hits        17311    17311              
- Misses      14119    14120       +1     
- Partials      769      770       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-project-automation github-project-automation Bot moved this from In progress to Reviewer approved in PR Tracker Aug 6, 2025
@justinchuby justinchuby merged commit 6a3d135 into onnx:main Aug 6, 2025
36 of 37 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewer approved to Done in PR Tracker Aug 6, 2025
MagellaX pushed a commit to MagellaX/onnx that referenced this pull request Aug 9, 2025
### Description
When given an empty input, ``softmax`` should return an output of the
same shape. Currently, an exception is raised by ``X.max`` in that case.

### Motivation and Context
We came across this problem when testing the onnxruntime via
[onnx-tests](https://github.com/cbourjau/onnx-tests).

Signed-off-by: Konstantin Pueckler <konstantin.pueckler@quantco.com>
Signed-off-by: Yash solanki <alphacr792@gmail.com>
@titaiwangms titaiwangms added the topic: operator Issues related to ONNX operators label Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: operator Issues related to ONNX operators

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants