LudovicoYIN commented on issue #18608:
URL: https://github.com/apache/tvm/issues/18608#issuecomment-3757898511
I patched the ONNX Resize converter to support non‑4D inputs (3D/5D) instead
of asserting on ndims==4.
Changes:
- In onnx_frontend.py (Resize._impl_v18), allow ndims in {3,4,5}.
- Keep 4D path unchanged: still uses relax.op.image.resize2d.
- For 3D: emit TE call topi.image.resize1d with layout NCW.
- For 5D: emit TE call topi.image.resize3d with layout NCDHW.
- Normalize mode: map ONNX nearest to nearest_neighbor (Topi expects
nearest_neighbor), and keep linear/cubic unchanged.
- ROI handling: if constant ROI has length 2*ndims, slice out spatial dims
(drop N/C). If ROI is None, use zeros of length 2*(ndims-2). Dynamic ROI still
unsupported (same as before for 2D).
The reproduction model (3D input, sizes=[1,1,1]) now imports and runs, and
output matches ONNX Runtime (assert_allclose OK).
Questions:
1. Is using topi.image.resize1d/resize3d via bb.emit_te acceptable in Relax
frontend (given only resize2d exists as a Relax op)?
2. Any preferred layout assumptions for 3D/5D (I used NCW and NCDHW,
consistent with ONNX N,C,spatial)?
3. Is there anything else I should consider that might be missing here?
If this direction is acceptable, I’m happy to take on the fix and contribute
the PR for this issue.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]