[Bug][Relax][Frontend][ONNX] ConvTranspose with 3D (5D) input fails in from_onnx: NotImplementedError
Expected behavior
A valid ONNX ConvTranspose model with 3D transposed convolution (5D input X: (N, C, D1, D2, D3)) should be imported successfully by tvm.relax.frontend.onnx.from_onnx, just like the 1D and 2D cases. The ONNX spec allows arbitrary N-D transposed convolution, and topi.nn.conv3d_transpose already exists, so the capability is present.
Actual behavior
from_onnx raises NotImplementedError:
NotImplementedError: Relax ConvTranspose3d not supported yet
raised at python/tvm/relax/frontend/onnx/onnx_frontend.py:1352 in ConvTranspose._impl_v1, which only handles ndim == 3 (1D) and ndim == 4 (2D) and hard-codes raise NotImplementedError for ndim == 5.
The same model passes onnx.checker and runs correctly in onnxruntime (output shape (1, 3, 6, 6, 6)), confirming it is a valid, runnable ONNX model.
Environment
- OS: Linux
- TVM: v0.24.dev0 (main branch, commit
262c6d2e0, built 2026-02-11) - Python: 3.11
- onnx: 1.20.1
- onnxruntime: 1.24.1
Steps to reproduce
"""Repro: 3D ConvTranspose is a valid & runnable ONNX model, but TVM relax frontend rejects it."""
import numpy as np
import onnx, onnxruntime
from onnx import helper, TensorProto
from tvm.relax.frontend.onnx import from_onnx
w = np.zeros((2, 3, 3, 3, 3), dtype="float32")
graph = helper.make_graph(
[helper.make_node("ConvTranspose", ["X", "W"], ["Y"])], "g",
[helper.make_tensor_value_info("X", TensorProto.FLOAT, [1, 2, 4, 4, 4])],
[helper.make_tensor_value_info("Y", TensorProto.FLOAT, [1, 3, 6, 6, 6])],
[helper.make_tensor("W", TensorProto.FLOAT, [2, 3, 3, 3, 3], w.tolist())],
)
model = helper.make_model(graph, opset_imports=[helper.make_opsetid("", 18)])
model.ir_version = 8
onnx.checker.check_model(model) # (1) valid ONNX model
x = np.random.rand(1, 2, 4, 4, 4).astype("float32")
y = onnxruntime.InferenceSession(model.SerializeToString()).run(None, {"X": x})[0]
print("onnxruntime runs OK ->", y.shape) # (2) reference impl works
from_onnx(model, shape_dict={"X": [1, 2, 4, 4, 4]}) # (3) TVM rejects the same model
Actual output:
onnxruntime runs OK -> (1, 3, 6, 6, 6)
Traceback (most recent call last):
...
File "tvm/relax/frontend/onnx/onnx_frontend.py", line 1352, in _impl_v1
raise NotImplementedError("Relax ConvTranspose3d not supported yet")
NotImplementedError: Relax ConvTranspose3d not supported yet
Triage
- needs-triage
- bug
- relax
- frontend/onnx
Hi @tlopex @siyiweigeHEW,
I’d like to work on this issue and contribute 3D ConvTranspose support to the Relax ONNX frontend. I’d be happy to take this up.
@siyiweigeHEW I tried to reproduce this issue on the latest main branch using the provided reproduction, and it works correctly for me. The model is successfully imported and lowered to R.nn.conv3d_transpose.
It looks like this issue has already been fixed by #18948, which added conv3d_transpose and ONNX ConvTranspose 3D support.
@siyiweigeHEW I tried to reproduce this issue on the latest
mainbranch using the provided reproduction, and it works correctly for me. The model is successfully imported and lowered toR.nn.conv3d_transpose.It looks like this issue has already been fixed by #18948, which added
conv3d_transposeand ONNXConvTranspose3D support.
Thanks for checking and confirming this! It looks like this issue has already been fixed by #18948. I appreciate you taking the time to investigate and reproduce it.