Skip to content

[Fix][Relax] Apply the RoiAlign half-pixel shift after scaling - #21075

Open
MilkFeng wants to merge 1 commit into
apache:mainfrom
MilkFeng:fix/roi-align-half-pixel-scale
Open

MilkFeng wants to merge 1 commit into
apache:mainfrom
MilkFeng:fix/roi-align-half-pixel-scale

Conversation

@MilkFeng

Copy link
Copy Markdown

Summary

Apply spatial_scale to ROI coordinates before subtracting 0.5 in the ONNX half_pixel and torchvision aligned=True import paths. Pass a unit scale to Relax ROIAlign after converting the coordinates into feature-map space.

Testing

  • Reproduced the reported ONNX result on LLVM CPU. The fix changes the half_pixel output from 41.25 to 38.5, matching ONNX Runtime.
  • Ran 19 ROIAlign tests covering the two frontends, Relax operator legalization, and TVMScript. All passed on LLVM CPU.

Prepared with OpenAI Codex assistance.

Fixes #21074

Scale ROI coordinates before applying the half-pixel offset in the ONNX and PyTorch frontends. Use a unit scale for the downstream operator and cover non-unit scales in both frontends.

Generated-by: OpenAI Codex

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] [Relax][ONNX] RoiAlign half_pixel applies the -0.5 offset before spatial_scale

1 participant