D-FINE icon indicating copy to clipboard operation
D-FINE copied to clipboard

Transforms v2 Compliance

Open broomhead opened this issue 7 months ago • 0 comments

Issue #170 inspired some work to update the transforms in this project to be transforms v2 compliant. Some of the code was still doing transforms the v1 way while being shoved into the v2 pipeline and throwing errors and causing problems.

I propose making a clean break to v2 transforms as well as v2 tv_tensor types. To this end, I have removed _misc.py completely as its attempts at backwards compatibility aren't going to work moving forward. _misc.py tried to support back to 0.15.2, but Torch Vision is at 0.22 today. There's enough time that new builds should be pulling in a version more recent anyway.

Only a couple files have significant changes; the rest are 1-2 line changes to imports to switch to functional and transforms v2, which are drop-in ready. You'll see changes like

import torchvision.transforms as T
import torchvision.transforms.functional as F

to

import torchvision.transforms.v2 as T
import torchvision.transforms.functional.v2 as F

I'll walk through the meatier parts.

broomhead avatar May 22 '25 04:05 broomhead