Skip to main content
← Lab

remapalign

confirmedupstream bugPython · kornia (PyTorch)Systems & data structuresJuly 25, 2026

the question

Does kornia's `remap` return an image unchanged under an identity pixel map on its default path?

what came out

kornia's `remap` normalizes the pixel map with the `2p/(size-1)` (align_corners=True) convention but defaults `align_corners` to False in the `grid_sample` call, so the two conventions disagree. An identity pixel map on a 5x5 image comes back scaled and shifted half a pixel (max error 18.0); `align_corners=True` is exact. Fix: default `align_corners=True`.

method & receipts

  • Result: confirmed
  • Reproducible one script re-runs the whole thing from scratch.
  • Tested — a correctness/benchmark suite ships alongside the code.

→ read the code and re-run it

github.com/v-code01/remapalign