THINKER-ONLY opened a new pull request, #19854:
URL: https://github.com/apache/tvm/pull/19854

   ONNX AffineGrid has an `align_corners` attribute, and the ONNX default is
   `align_corners=0`. The Relax ONNX frontend previously rejected AffineGrid 
models
   that used this default, so a valid ONNX model could not be imported unless it
   explicitly used the Relax-supported aligned-corners behavior.
   
   This change adds an `align_corners` attribute to Relax `image.affine_grid`,
   threads it through legalization, and updates the TOPI implementation to 
generate
   coordinates for both alignment modes. The Relax Python API keeps the existing
   default of `align_corners=True` to preserve current behavior, while the ONNX
   frontend reads the ONNX attribute and uses ONNX's default value of `0`.
   
   The tests cover Relax struct-info inference, legalization, the TOPI reference
   path, and ONNX import/execution for both `align_corners=0` and
   `align_corners=1`.
   
   Fixes #19690.
   
   Testing:
   
   - `cmake --build build --parallel $(nproc)`
   - `pre-commit run --files <changed files>`
   - `pytest tests/python/relax/test_op_image.py 
tests/python/relax/test_transform_legalize_ops_image.py -q`
   - `pytest tests/python/relax/test_frontend_onnx.py -k 'affine_grid or 
grid_sample' -q`
   ```
   
   Main files changed:
   
   - `include/tvm/relax/attrs/image.h`
   - `src/relax/op/image/resize.cc`
   - `src/relax/op/image/resize.h`
   - `python/tvm/relax/op/image/image.py`
   - `python/tvm/relax/op/op_attrs.py`
   - `python/tvm/relax/transform/legalize_ops/image.py`
   - `python/tvm/topi/image/grid_sample.py`
   - `python/tvm/topi/testing/grid_sample_python.py`
   - `python/tvm/relax/frontend/onnx/onnx_frontend.py`
   - `tests/python/relax/test_op_image.py`
   - `tests/python/relax/test_transform_legalize_ops_image.py`
   - `tests/python/relax/test_frontend_onnx.py`
   
   Local verification after rebasing onto `093d785e2`:
   
   - Build passed.
   - Pre-commit passed.
   - Relax image/legalize tests: `31 passed`.
   - ONNX affine/grid selected tests: `38 passed, 671 deselected`.
   


-- 
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]

Reply via email to