Skip to content
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

[FBcode->GH] Remove deprecated functional modules #7953

Merged
merged 3 commits into from
Nov 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 1 addition & 32 deletions test/test_transforms.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
import os
import random
import re
import textwrap
from functools import partial

import numpy as np
Expand All @@ -24,7 +23,7 @@
except ImportError:
stats = None

from common_utils import assert_equal, assert_run_python_script, cycle_over, float_dtypes, int_dtypes
from common_utils import assert_equal, cycle_over, float_dtypes, int_dtypes


GRACE_HOPPER = get_file_path_2(
Expand Down Expand Up @@ -2241,35 +2240,5 @@ def test_random_grayscale_with_grayscale_input():
torch.testing.assert_close(F.pil_to_tensor(output_pil), image_tensor)


# TODO: remove in 0.17 when we can delete functional_pil.py and functional_tensor.py
@pytest.mark.parametrize(
"import_statement",
(
"from torchvision.transforms import functional_pil",
"from torchvision.transforms import functional_tensor",
"from torchvision.transforms.functional_tensor import resize",
"from torchvision.transforms.functional_pil import resize",
),
)
@pytest.mark.parametrize("from_private", (True, False))
def test_functional_deprecation_warning(import_statement, from_private):
if from_private:
import_statement = import_statement.replace("functional", "_functional")
source = f"""
import warnings

with warnings.catch_warnings():
warnings.simplefilter("error")
{import_statement}
"""
else:
source = f"""
import pytest
with pytest.warns(UserWarning, match="removed in 0.17"):
{import_statement}
"""
assert_run_python_script(textwrap.dedent(source))


if __name__ == "__main__":
pytest.main([__file__])
11 changes: 0 additions & 11 deletions torchvision/transforms/functional_pil.py

This file was deleted.

11 changes: 0 additions & 11 deletions torchvision/transforms/functional_tensor.py

This file was deleted.

Loading