Skip to content

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

Open
EnriqueGlv wants to merge 1 commit into
Intellindust-AI-Lab:mainfrom
EnriqueGlv:main
Open

Added torchvision.transforms.v2.Transform.transform overrides to enable torchvision>=0.21 support#47
EnriqueGlv wants to merge 1 commit into
Intellindust-AI-Lab:mainfrom
EnriqueGlv:main

Conversation

@EnriqueGlv

Copy link
Copy Markdown

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".

@jerrytyf

jerrytyf commented Jul 7, 2025

Copy link
Copy Markdown

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

@1yuyin1

1yuyin1 commented Jul 8, 2025

Copy link
Copy Markdown

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

#104 have more detail, see files changed ,just one file need to modify,and in torchvision 0.22.1 is ok

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.

3 participants