🐛 Describe the bug
I ran across this bug when developing Executorch NXP backend.
The issue occurs when I enable aten.conv_transpose2d, that is later transformed into Edge aten.convolution with argument transposed=True.
When output_channels argument for such transposed convolution is set to 1, (probably) portable kernels have issue with a different dim_order of the weights. For output_channels > 1, the issue does not occur.
According to Torch documentation, forward conv2d has weights in format: (out_channels, in_channels / groups, kernel_size[0], kernel_size[1]), but transposed conv_transpose2d weight format is (in_channels, out_channels / groups, kernel_size[0], kernel_size[1]). This difference then corresponds to the error message I am getting, ie. unexpected dim_order:
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 D 00:00:00.000009 executorch:operator_registry.cpp:116] Successfully registered all kernels from shared library: NOT_SUPPORTED
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 D 00:00:00.000047 executorch:operator_registry.cpp:116] Successfully registered all kernels from shared library: NOT_SUPPORTED
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 D 00:00:00.000142 executorch:operator_registry.cpp:116] Successfully registered all kernels from shared library: NOT_SUPPORTED
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 D 00:00:00.000518 executorch:method.cpp:861] Loading method: forward.
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 Loading file /home/nxg16998/code/executorch-integration/.outputs/TestTransposedConv__test__transp_conv__unusual_shapes[PTQ-unusual_shape_inference__ic=_2__9__9__13___oc=1__ks=3__s=2__d=1__p=0__op=0__b=True__g=1]/dataset_quant/0001.bin
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 D 00:00:00.000634 executorch:method.cpp:1714] Executing method: forward.
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000677 executorch:tensor_util_portable.cpp:64] Expected tensor to have default or channels last dim order, but got
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000689 executorch:tensor_util_portable.cpp:68] dim_order(0): 1
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000691 executorch:tensor_util_portable.cpp:68] dim_order(1): 0
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000691 executorch:tensor_util_portable.cpp:68] dim_order(2): 2
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000692 executorch:tensor_util_portable.cpp:68] dim_order(3): 3
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000693 executorch:kernel_ops_util.cpp:385] Check failed (tensor_is_default_or_channels_last_dim_order(weight)):
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000696 executorch:op_convolution.cpp:363] Check failed (check_convolution_args( in, weight, bias, stride, padding, dilation, transposed, output_padding, groups, out)):
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000700 executorch:method.cpp:1480] KernelCall failed at instruction 0:3 in operator aten::convolution.out: 0x12
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000701 executorch:method.cpp:1490] arg 0 with type id 1
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000702 executorch:method.cpp:1490] arg 1 with type id 1
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000702 executorch:method.cpp:1490] arg 2 with type id 1
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000703 executorch:method.cpp:1490] arg 3 with type id 8
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000704 executorch:method.cpp:1490] arg 4 with type id 8
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000704 executorch:method.cpp:1490] arg 5 with type id 8
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000705 executorch:method.cpp:1490] arg 6 with type id 5
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000705 executorch:method.cpp:1490] arg 7 with type id 8
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000706 executorch:method.cpp:1490] arg 8 with type id 4
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000706 executorch:method.cpp:1490] arg 9 with type id 1
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 E 00:00:00.000707 executorch:method.cpp:1490] arg 10 with type id 1
WARNING executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:726 Execution of method forward failed with status 18...
CRITICAL executorch.backends.nxp.tests.nsys_testing:nsys_testing.py:730 D 00:00:00.000009 executorch:operator_registry.cpp:116] Successfully registered all kernels from shared library: NOT_SUPPORTED
D 00:00:00.000047 executorch:operator_registry.cpp:116] Successfully registered all kernels from shared library: NOT_SUPPORTED
D 00:00:00.000142 executorch:operator_registry.cpp:116] Successfully registered all kernels from shared library: NOT_SUPPORTED
D 00:00:00.000518 executorch:method.cpp:861] Loading method: forward.
Loading file /home/nxg16998/code/executorch-integration/.outputs/TestTransposedConv__test__transp_conv__unusual_shapes[PTQ-unusual_shape_inference__ic=_2__9__9__13___oc=1__ks=3__s=2__d=1__p=0__op=0__b=True__g=1]/dataset_quant/0001.bin
D 00:00:00.000634 executorch:method.cpp:1714] Executing method: forward.
E 00:00:00.000677 executorch:tensor_util_portable.cpp:64] Expected tensor to have default or channels last dim order, but got
E 00:00:00.000689 executorch:tensor_util_portable.cpp:68] dim_order(0): 1
E 00:00:00.000691 executorch:tensor_util_portable.cpp:68] dim_order(1): 0
E 00:00:00.000691 executorch:tensor_util_portable.cpp:68] dim_order(2): 2
E 00:00:00.000692 executorch:tensor_util_portable.cpp:68] dim_order(3): 3
E 00:00:00.000693 executorch:kernel_ops_util.cpp:385] Check failed (tensor_is_default_or_channels_last_dim_order(weight)):
E 00:00:00.000696 executorch:op_convolution.cpp:363] Check failed (check_convolution_args( in, weight, bias, stride, padding, dilation, transposed, output_padding, groups, out)):
E 00:00:00.000700 executorch:method.cpp:1480] KernelCall failed at instruction 0:3 in operator aten::convolution.out: 0x12
E 00:00:00.000701 executorch:method.cpp:1490] arg 0 with type id 1
E 00:00:00.000702 executorch:method.cpp:1490] arg 1 with type id 1
E 00:00:00.000702 executorch:method.cpp:1490] arg 2 with type id 1
E 00:00:00.000703 executorch:method.cpp:1490] arg 3 with type id 8
E 00:00:00.000704 executorch:method.cpp:1490] arg 4 with type id 8
E 00:00:00.000704 executorch:method.cpp:1490] arg 5 with type id 8
E 00:00:00.000705 executorch:method.cpp:1490] arg 6 with type id 5
E 00:00:00.000705 executorch:method.cpp:1490] arg 7 with type id 8
E 00:00:00.000706 executorch:method.cpp:1490] arg 8 with type id 4
E 00:00:00.000706 executorch:method.cpp:1490] arg 9 with type id 1
E 00:00:00.000707 executorch:method.cpp:1490] arg 10 with type id 1
Execution of method forward failed with status 18...
I am trying to lower the following model, where input_shape is (1, 9, 9, 13)andout_channels = 1. Everything else is left default in Conv2dTransposedModule`:
class Conv2dTransposedModule(torch.nn.Module):
def __init__(
self,
bias: bool = True,
dilation: Union[int, tuple[int, int]] = 1,
in_channels: int = 4,
kernel_size: Union[int, tuple[int, int]] = 3,
out_channels: int = 8,
padding: Union[str, int, Collection[int]] = 0,
output_padding: Union[int, tuple[int, int]] = 0,
stride: Union[int, tuple[int, int]] = 2,
group: int = 1,
):
super().__init__()
self.conv_transp = torch.nn.ConvTranspose2d(
in_channels=in_channels,
out_channels=out_channels,
kernel_size=kernel_size,
stride=stride,
padding=padding,
output_padding=output_padding,
dilation=dilation,
bias=bias,
groups=group,
)
def forward(self, x):
return self.conv_transp(x)
What could be the issue?
Versions
Collecting environment information...
PyTorch version: 2.12.0+cpu
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: Ubuntu 24.04.3 LTS (x86_64)
GCC version: (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0
Clang version: 18.1.3 (1ubuntu1)
CMake version: version 3.31.10
Libc version: glibc-2.39
Python version: 3.12.3 (main, Jun 19 2026, 12:46:00) [GCC 13.3.0] (64-bit runtime)
Python platform: Linux-6.6.87.2-microsoft-standard-WSL2-x86_64-with-glibc2.39
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
Is XPU available: False
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Caching allocator config: N/A
CPU:
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Address sizes: 46 bits physical, 48 bits virtual
Byte Order: Little Endian
CPU(s): 16
On-line CPU(s) list: 0-15
Vendor ID: GenuineIntel
Model name: 13th Gen Intel(R) Core(TM) i5-1350P
CPU family: 6
Model: 186
Thread(s) per core: 2
Core(s) per socket: 8
Socket(s): 1
Stepping: 2
BogoMIPS: 4377.61
Flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl xtopology tsc_reliable nonstop_tsc cpuid tsc_known_freq pni pclmulqdq vmx ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb sha_ni xsaveopt xsavec xgetbv1 xsaves avx_vnni vnmi umip waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize flush_l1d arch_capabilities
Virtualization: VT-x
Hypervisor vendor: Microsoft
Virtualization type: full
L1d cache: 384 KiB (8 instances)
L1i cache: 256 KiB (8 instances)
L2 cache: 10 MiB (8 instances)
L3 cache: 12 MiB (1 instance)
NUMA node(s): 1
NUMA node0 CPU(s): 0-15
Vulnerability Gather data sampling: Not affected
Vulnerability Itlb multihit: Not affected
Vulnerability L1tf: Not affected
Vulnerability Mds: Not affected
Vulnerability Meltdown: Not affected
Vulnerability Mmio stale data: Not affected
Vulnerability Reg file data sampling: Mitigation; Clear Register File
Vulnerability Retbleed: Mitigation; Enhanced IBRS
Vulnerability Spec rstack overflow: Not affected
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl
Vulnerability Spectre v1: Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2: Mitigation; Enhanced / Automatic IBRS; IBPB conditional; RSB filling; PBRSB-eIBRS SW sequence; BHI BHI_DIS_S
Vulnerability Srbds: Not affected
Vulnerability Tsx async abort: Not affected
Versions of relevant libraries:
[pip3] executorch==1.4.0a0+c825c91
[pip3] flake8==6.1.0
[pip3] flake8-breakpoint==1.1.0
[pip3] flake8-bugbear==24.4.26
[pip3] flake8-comprehensions==3.14.0
[pip3] flake8-plugin-utils==1.3.3
[pip3] flake8-pyi==23.5.0
[pip3] mypy==1.14.1
[pip3] mypy_extensions==1.1.0
[pip3] numpy==2.0.0
[pip3] optree==0.19.1
[pip3] pytorch_tokenizers==1.3.0
[pip3] torch==2.12.0+cpu
[pip3] torchao==0.17.0+git02105d46c
[pip3] torchaudio==2.11.0+cpu
[pip3] torchdata==0.11.0+cpu
[pip3] torchsr==1.0.4
[pip3] torchtune==0.0.0
[pip3] torchvision==0.27.0+cpu
[conda] Could not collect
🐛 Describe the bug
I ran across this bug when developing Executorch NXP backend.
The issue occurs when I enable
aten.conv_transpose2d, that is later transformed into Edgeaten.convolutionwith argumenttransposed=True.When
output_channelsargument for such transposed convolution is set to1, (probably) portable kernels have issue with a differentdim_orderof the weights. Foroutput_channels > 1, the issue does not occur.According to Torch documentation, forward
conv2dhas weights in format:(out_channels, in_channels / groups, kernel_size[0], kernel_size[1]), but transposedconv_transpose2dweight format is(in_channels, out_channels / groups, kernel_size[0], kernel_size[1]). This difference then corresponds to the error message I am getting, ie. unexpecteddim_order:I am trying to lower the following model, where
input_shapeis (1, 9, 9, 13)andout_channels = 1. Everything else is left default inConv2dTransposedModule`:What could be the issue?
Versions