Skip to content

Deprecate functional_pil and functional_tensor and make them private #7269

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 16, 2023

Conversation

NicolasHug
Copy link
Member

@NicolasHug NicolasHug commented Feb 16, 2023

This PR moves functional_pil.py into _functional_pil.py and let functional_pil.py have the same content (ish), with a warning.
The changes are made for functional_tensor.py.

These changes are hard to test because if we want to make sure all scenarios raise the proper warning, we need multiple executions of the Python interpreter. This can be done via utils like this one form scikit-learn which is used like this.

I... can't be arsed to go through that right now. If you have a better idea, LMK :)
As manual check, all those blocks below properly raise the warning:

from torchvision.transforms import functional_pil # warns
import torchvision.transforms.functional_pil as fp # warns

from torchvision.transforms.functional_pil import resize # warns
print(resize)

# Importing stuff that was already private breaks: this is for the best?
# from torchvision.transforms.functional_pil import _parse_fill  # Breaks
# from torchvision.transforms.functional_tensor import _is_tensor_a_torch_image  # Breaks

from torchvision.transforms import functional_tensor # warns
import torchvision.transforms.functional_tensor as ft #warns

from torchvision.transforms.functional_tensor import resize # warns
print(resize)

cc @vfdev-5

@NicolasHug
Copy link
Member Author

And sadly git doesn't understand it was a simple git mv rather than a big change... So the diff looks much bigger than it actually should. Not sure we can do much about this either.

@NicolasHug NicolasHug requested review from pmeier and vfdev-5 February 16, 2023 14:54
Copy link
Collaborator

@vfdev-5 vfdev-5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks @NicolasHug

Copy link
Collaborator

@pmeier pmeier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM if CI is green. Thanks Nicolas!

@NicolasHug
Copy link
Member Author

Thanks for the reviews, failures are unrelated, merging

@NicolasHug NicolasHug merged commit 55d3ba6 into pytorch:main Feb 16, 2023
@github-actions
Copy link

Hey @NicolasHug!

You merged this PR, but no labels were added. The list of valid labels is available at https://github.com/pytorch/vision/blob/main/.github/process_commit.py

facebook-github-bot pushed a commit that referenced this pull request Mar 28, 2023
… private (#7269)

Reviewed By: vmoens

Differential Revision: D44416620

fbshipit-source-id: 37a242f4ed899e847b7395700650ced038fb3f0b
@Ahmaddimran
Copy link

At this line of code: from pytorchvideo.transforms import (ApplyTransformToKey, Normalize,UniformTemporalSubsample) I am getting ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor' how can I solve this after this depreciation?

@wohaoeRiver
Copy link

wohaoeRiver commented Aug 23, 2024

在这行代码中: from pytorchvideo.transforms import (ApplyTransformToKey, Normalize,UniformTemporalSubsample) 我收到 ModuleNotFoundError: No module named 'torchvision.transforms.function_tensor' 折旧后如何解决此问题?

@Ahmaddimran TorchVision Version Issue: Use a version below 0.17, or modify the degradations.py file in your Python directory by replacing
from torchvision.transforms.functional_tensor import rgb_to_grayscale with from torchvision.transforms.functional import rgb_to_grayscale.

@aminakmim
Copy link

At this line of code: from pytorchvideo.transforms import (ApplyTransformToKey, Normalize,UniformTemporalSubsample) I am getting ModuleNotFoundError: No module named 'torchvision.transforms.functional_tensor' how can I solve this after this depreciation?

facing same issue

yuedanlabs added a commit to yuedanlabs/DFDAN that referenced this pull request Dec 2, 2024
@ibtehajali67
Copy link

python -m pip install torch==2.0.1 torchvision==0.15.2 --extra-index-url https://download.pytorch.org/whl/cu118

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants