Describe the issue
Summary
For NHWC-capable execution providers, layout transformation in ONNX Runtime currently depends too heavily on input tensor shape information to determine rank for layout-sensitive operators. In complex dynamic-shape models, input rank is often unavailable from ValueInfo during optimization, causing layout transformation analysis to skip eligible nodes even when their spatial rank could be derived from operator attributes.
Problem
The current behavior is too restrictive for convolution and pooling related operators. For ops such as Conv, ConvTranspose, MaxPool, and AveragePool, the spatial rank is often already encoded in attributes like kernel_shape, strides, dilations, pads, output_padding, or output_shape. However, when input rank is missing from ValueInfo, layout transformation cannot proceed and the node is skipped.
This makes NHWC conversion fragile for models with dynamic or partially inferred shapes, where shape information is commonly incomplete during optimization.
Affected operators
- Conv
- ConvTranspose
- ConvInteger
- QLinearConv
- FusedConv
- AveragePool
- LpPool
- MaxPool
- MaxUnpool
- QLinearAveragePool
To reproduce
#27908 I’ve tried to resolve this via this PR
Urgency
No response
Platform
Linux
OS Version
24.04
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
318a251
ONNX Runtime API
C++
Architecture
X64
Execution Provider
Other / Unknown
Execution Provider Library Version
No response
Describe the issue
Summary
For NHWC-capable execution providers, layout transformation in ONNX Runtime currently depends too heavily on input tensor shape information to determine rank for layout-sensitive operators. In complex dynamic-shape models, input rank is often unavailable from ValueInfo during optimization, causing layout transformation analysis to skip eligible nodes even when their spatial rank could be derived from operator attributes.
Problem
The current behavior is too restrictive for convolution and pooling related operators. For ops such as Conv, ConvTranspose, MaxPool, and AveragePool, the spatial rank is often already encoded in attributes like kernel_shape, strides, dilations, pads, output_padding, or output_shape. However, when input rank is missing from ValueInfo, layout transformation cannot proceed and the node is skipped.
This makes NHWC conversion fragile for models with dynamic or partially inferred shapes, where shape information is commonly incomplete during optimization.
Affected operators
To reproduce
#27908 I’ve tried to resolve this via this PR
Urgency
No response
Platform
Linux
OS Version
24.04
ONNX Runtime Installation
Built from Source
ONNX Runtime Version or Commit ID
318a251
ONNX Runtime API
C++
Architecture
X64
Execution Provider
Other / Unknown
Execution Provider Library Version
No response