[Relax][ONNX] Add image.resize3d op and wire 5D Resize#18931
Conversation
Add Relax image.resize3d end-to-end (attrs, C++ registration, Python API, and legalization to TOPI), then route ONNX 5D Resize through the new Relax op instead of direct emit_te. Expand tests across op inference, parser, legalization, ONNX import, and resize3d negative cases to lock behavior and reduce review risk.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the image processing capabilities within Relax by introducing a new Highlights
🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console. Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new resize3d operator to the TVM Relax framework, extending image processing capabilities to 3D tensors. The changes involve defining new attributes for the resize3d operation, implementing its Python frontend and C++ backend, including operator registration, type inference, and layout inference. The ONNX frontend is updated to utilize this new operator for 5D tensor resizing, and comprehensive test cases have been added to validate its functionality and integration. A critical issue was identified in the resize3d C++ implementation where the argument count validation is incorrect, potentially leading to a crash due to out-of-bounds access if only one argument is passed, which also suggests a similar bug in the resize2d implementation.
|
@tlopex Because there was a reference, the task was completed quickly. Next, I hope to take on the PyTorch fixes, but before that, I need to wait for this PR to be reviewed. |
tlopex
left a comment
There was a problem hiding this comment.
Overall looks good to me, could you correct the point that gemini suggested?
InferStructInfo previously allowed one argument due to a flawed size check, which could lead to out-of-bounds access on args[1]. Align checks with set_num_inputs(2) for both resize2d and resize3d.
|
@tlopex We have resolved the issue and are awaiting approval. |
tlopex
left a comment
There was a problem hiding this comment.
Now it looks good. Thank you @Dayuxiaoshui
Summary
image.resize3dend-to-end: attrs, C++ op registration/inference, Python API, and legalization totopi.image.resize3d.Resizeto emitrelax.image.resize3dinstead of directemit_te(topi.image.resize3d).resize2dimplementation pattern, which let us move faster while keeping behavior consistent and risk low.resize3dnegative/error cases.Test Plan
python3 -m pytest -q tests/python/relax/test_op_image.py -k 'resize3d'python3 -m pytest -q tests/python/relax/test_transform_legalize_ops_image.py -k 'resize3d'python3 -m pytest -q tests/python/relax/test_tvmscript_parser_op_image.py -k 'resize3d'python3 -m pytest -q tests/python/relax/test_frontend_onnx.py -k 'resize_nd_sizes or resize_5d_emits_relax_resize3d'