DEIM icon indicating copy to clipboard operation
DEIM copied to clipboard

Added torchvision.transforms.v2.Transform.transform overrides to enable torchvision>=0.21 support

Open EnriqueGlv opened this issue 10 months ago • 2 comments

Several issues were complaining about a NotImplementedError raised by torchvision.transforms.v2.Transform.transform.

The reason of this issue is that torchvision>=0.21 renamed the method that needs to be overridden when creating a custom transform. (see https://pytorch.org/vision/stable/generated/torchvision.transforms.v2.Transform.html#torchvision.transforms.v2.Transform.transform )

To fix this issue without breaking the support of older torchvision versions, I simply duplicated the methods "_transform" of the custom transforms and renamed them "transform".

EnriqueGlv avatar Mar 13 '25 14:03 EnriqueGlv

I found there are many "def _transform". did you mean that I should modify each of them under your guidance?

jerrytyf avatar Jul 07 '25 16:07 jerrytyf

I found there are many "def _transform". did you mean that I should modify each of them under your guidance?

https://github.com/ShihuaHuang95/DEIM/pull/104 have more detail, see files changed ,just one file need to modify,and in torchvision 0.22.1 is ok

1yuyin1 avatar Jul 08 '25 08:07 1yuyin1