#9387·vision

Investigate merging box conversion utils from ops and transforms

Author: zy1gitCreated Feb 16, 2026Updated Sep 5, 2026

Currently, we have similar box conversion functionality implemented in two places:

  • torchvision/ops/_box_convert.py

  • torchvision/transforms/v2/functional/_meta.py

This duplication is not ideal and could lead to inconsistencies (e.g., different rounding behavior for integer tensors).

Suggested investigation:

  • Compare the two implementations for correctness and consistency

  • Run benchmarks to evaluate which implementation is more efficient

  • Merge them into one.

Considerations:

The transforms version supports inplace operations, while the ops version does not. Any changes should maintain backward compatibility

Related: PR #9322 (Fix CXCYWH to XYXY conversion for integer bounding boxes)