6 Commits

Author SHA1 Message Date
Tianqi Chen c1d32438a0 [BugFix][TOPI] Fix resize accuracy issue with non-floor rounding (#18838)
## Summary

The int_div optimization in `topi.image.resize` was applied
unconditionally
for `nearest_neighbor` + `asymmetric` mode, regardless of rounding
method.
This caused accuracy issues when `rounding_method` is not `"floor"`
(e.g.,
`"round"`, `"round_prefer_ceil"`), because integer division truncates
toward
zero rather than rounding.

**Fix**: Gate the int_div optimization on `rounding_method == "floor"`
or
`rounding_method == ""` (the default, which gets resolved to `"floor"`
for
non-align_corners modes).

- Updates `_resize_2d` in `python/tvm/topi/image/resize.py`
- Updates reference implementation in
`python/tvm/topi/testing/resize_python.py`
- Updates legalize test expected output to reflect the new behavior
2026-02-27 11:21:16 -05:00
Tianqi Chen 33dcea1686 [REFACTOR][LINT] Modernize ruff config (#18810)
This PR removes the extra lint violations from the codebase so lint
aligns with the latest style
2026-02-23 07:29:21 -05:00
Tianqi Chen aa2e609136 [LINT] Modernize lint to use pre-commit hooks (#18807)
This PR migrates existing lint to use pre-commit hooks
2026-02-22 11:03:21 -05:00
Krzysztof Parzyszek 48200fc3d7 [TOPI] Use f-strings for string formatting, NFC (#14822)
* [TOPI] Use f-strings for string formatting, NFC

Replace uses of % and .format() with f-strings.

* Format updated files
2023-05-11 16:13:10 +09:00
Matthew Brookhart 22c7d6107f speed up reference resize kernel (#8592) 2021-07-30 09:49:19 -04:00
Matthew Brookhart d3fc562a6f [Relay][TOPI] Resize 1D (#8346)
* rename resize to resize2d

* refactor resize_2d

* Add resize1d op, normalize attribute names across ops

* normalize resize3d to match the API of 1D and 2D

* fix lint

* fix relay tests from API change

* refactor topi tests, docs

* fix method naming in framework frontends

fix more frontend issues

* refactor resize tests to reuse components, add more coordinate tranform modes to tests

* add cubic resize reference kernel and tests, add relay tests for resize1d

* fix pylint

* fix test typo
2021-07-05 19:09:26 +09:00