Commit 2b4b58d
authored
[Relax][Onnx][Resize] Handle non-4D input tensors (#18666)
### Motivation
The ONNX Resize operator supports resizing N-D tensors per the ONNX
specification.
However, the current Relax ONNX frontend only supports 4D inputs and
raises an
assertion error for valid non-4D models.
This PR extends the Relax ONNX Resize converter beyond the 4D-only
restriction,
aligning behavior with the ONNX specification and ONNX Runtime for
supported ranks.
### Changes
- Remove the 4D-only assertion in the Relax ONNX Resize converter
- Preserve the existing 4D resize path without behavior changes
- Support non-4D Resize by lowering to existing resize implementations
for supported ranks
- Ensure Resize attributes are handled correctly for non-4D cases
### Testing
- Verified outputs against ONNX Runtime
- Added ONNX Resize tests covering non-4D input cases
(`test_resize_nd_sizes`)
Fixes: [[Bug] Resize N-D import failure: TVM only supports 4D resize2d,
but ONNX Resize supports N-D tensors
https://github.com/apache/tvm/issues/18608](https://github.com/apache/tvm/issues/18608)1 parent eb4eb3e commit 2b4b58d
2 files changed
Lines changed: 85 additions & 16 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2235 | 2235 | | |
2236 | 2236 | | |
2237 | 2237 | | |
2238 | | - | |
| 2238 | + | |
| 2239 | + | |
| 2240 | + | |
| 2241 | + | |
2239 | 2242 | | |
2240 | 2243 | | |
2241 | 2244 | | |
2242 | 2245 | | |
2243 | 2246 | | |
2244 | 2247 | | |
2245 | 2248 | | |
2246 | | - | |
| 2249 | + | |
2247 | 2250 | | |
2248 | 2251 | | |
2249 | 2252 | | |
| |||
2253 | 2256 | | |
2254 | 2257 | | |
2255 | 2258 | | |
| 2259 | + | |
| 2260 | + | |
2256 | 2261 | | |
2257 | 2262 | | |
2258 | 2263 | | |
| |||
2262 | 2267 | | |
2263 | 2268 | | |
2264 | 2269 | | |
2265 | | - | |
| 2270 | + | |
2266 | 2271 | | |
2267 | | - | |
| 2272 | + | |
2268 | 2273 | | |
2269 | 2274 | | |
2270 | 2275 | | |
| |||
2287 | 2292 | | |
2288 | 2293 | | |
2289 | 2294 | | |
2290 | | - | |
2291 | | - | |
2292 | | - | |
2293 | | - | |
2294 | | - | |
2295 | | - | |
2296 | | - | |
2297 | | - | |
2298 | | - | |
2299 | | - | |
2300 | | - | |
2301 | | - | |
| 2295 | + | |
| 2296 | + | |
| 2297 | + | |
| 2298 | + | |
| 2299 | + | |
| 2300 | + | |
| 2301 | + | |
| 2302 | + | |
| 2303 | + | |
| 2304 | + | |
| 2305 | + | |
| 2306 | + | |
| 2307 | + | |
| 2308 | + | |
| 2309 | + | |
| 2310 | + | |
| 2311 | + | |
| 2312 | + | |
| 2313 | + | |
| 2314 | + | |
| 2315 | + | |
| 2316 | + | |
| 2317 | + | |
| 2318 | + | |
| 2319 | + | |
| 2320 | + | |
| 2321 | + | |
| 2322 | + | |
| 2323 | + | |
| 2324 | + | |
| 2325 | + | |
| 2326 | + | |
| 2327 | + | |
| 2328 | + | |
| 2329 | + | |
| 2330 | + | |
| 2331 | + | |
| 2332 | + | |
| 2333 | + | |
| 2334 | + | |
| 2335 | + | |
2302 | 2336 | | |
2303 | 2337 | | |
2304 | 2338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2681 | 2681 | | |
2682 | 2682 | | |
2683 | 2683 | | |
| 2684 | + | |
| 2685 | + | |
| 2686 | + | |
| 2687 | + | |
| 2688 | + | |
| 2689 | + | |
| 2690 | + | |
| 2691 | + | |
| 2692 | + | |
| 2693 | + | |
| 2694 | + | |
| 2695 | + | |
| 2696 | + | |
| 2697 | + | |
| 2698 | + | |
| 2699 | + | |
| 2700 | + | |
| 2701 | + | |
| 2702 | + | |
| 2703 | + | |
| 2704 | + | |
| 2705 | + | |
| 2706 | + | |
| 2707 | + | |
| 2708 | + | |
| 2709 | + | |
| 2710 | + | |
| 2711 | + | |
| 2712 | + | |
| 2713 | + | |
| 2714 | + | |
| 2715 | + | |
| 2716 | + | |
| 2717 | + | |
| 2718 | + | |
2684 | 2719 | | |
2685 | 2720 | | |
2686 | 2721 | | |
| |||
0 commit comments