Treatment of optional inputs to nodes when empty #22035
Labels
core runtime
issues related to core runtime
stale
issues that have not been addressed in a while; categorized by a bot
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
onnxruntime/onnxruntime/core/providers/cuda/reduction/reduction_ops.cc
Lines 648 to 652 in 493159b
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
The text was updated successfully, but these errors were encountered: