Conversation
`can_convert_multiply_to_intdiv` was enabled unconditionally for `nearest_neighbor` + `asymmetric` mode, even when `rounding_method` is not `floor`. This converted the mapped coordinate via integer division (equivalent to floor) regardless of the requested rounding, producing wrong results whenever the target size is an exact integer multiple of the source size. Fix: guard the `can_convert_multiply_to_intdiv` optimisation so it only activates when `rounding_method` is `"floor"` or `""` (which defaults to `"floor"` for asymmetric mode). Also update the Python reference implementation (`resize_python.py`) to accept and thread a `rounding_method` parameter through all public entry points (`get_index`, `resize3d_nearest`, `resize3d_ncdhw`, `resize1d_python`, `resize2d_python`, `resize3d_python`), so the reference matches the corrected TVM behaviour. Add `tests/python/te/test_topi_resize2d.py` with regression tests that exercise the buggy path (non-floor rounding + asymmetric + integer scale factor) as well as sanity checks for floor rounding and non-integer scale factors. Fixes: apache#16137
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 re-implements a fix related to resize operations, primarily enhancing the flexibility and precision of nearest neighbor interpolation. It introduces a 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. Changelog
Activity
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. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces support for different rounding methods in the resize operator, specifically for the nearest_neighbor method. It also includes some code cleanup by removing unnecessary ruff: noqa comments. My review focuses on the correctness of the Python test implementation for the new rounding logic. I found a discrepancy between the test implementation and the te implementation for the "round" method and have suggested a fix to ensure the test accurately reflects the behavior of the te operator.
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/22467141538 Detailswith response |
|
@tvm-bot rerun |
|
Failed to re-run CI in https://github.com/apache/tvm/actions/runs/22469893994 Detailswith response |
This PR relands the resize fix