Treatment of optional inputs to nodes when empty
Describe the issue
In the pytorch-onnx exporter, when an optional input is not provided, it is defaulted to None, which gets translates to "" in the onnx graph. Semantically, "" and nothing should be the same in the ONNX spec, however this runs into issues for ops such as reduction ops and squeeze.
To reproduce
https://github.com/microsoft/onnxruntime/blob/493159b48110b93344845bea921567bf0a668ab3/onnxruntime/core/providers/cuda/reduction/reduction_ops.cc#L648-L652
In this example for Reduction ops, let's say we have axes=None, this is now exported as axes="". So ORT still counts this as two inputs and the example fails as axes is Null. Ideally, this empty input, should not count as one of the inputs to the node.
Urgency
No response
Platform
Linux
OS Version
Mariner 2.0
ONNX Runtime Installation
Released Package
ONNX Runtime Version or Commit ID
1.18.0
ONNX Runtime API
Python
Architecture
X64
Execution Provider
Default CPU, CUDA
Execution Provider Library Version
CUDA 12.4
Yeah - that's a bug. It should be checking to handle the 'input with empty name' case.
This issue has been automatically marked as stale due to inactivity and will be closed in 30 days if no further activity occurs. If further support is needed, please provide an update and/or more details.
This issue has been automatically closed as 'not planned' because it has been marked as 'stale' for more than 30 days without activity. If you believe this is still an issue, please feel free to reopen it.
This issue has been automatically closed as 'not planned' because it has been marked as 'stale' for more than 30 days without activity. If you believe this is still an issue, please feel free to reopen it.