|
1 | 1 | import itertools
|
2 | 2 | import pathlib
|
3 | 3 | import random
|
4 |
| -import textwrap |
5 | 4 | import warnings
|
6 | 5 |
|
7 | 6 | import numpy as np
|
|
11 | 10 | import torch
|
12 | 11 | import torchvision.transforms.v2 as transforms
|
13 | 12 |
|
14 |
| -from common_utils import assert_equal, assert_run_python_script, cpu_and_cuda |
| 13 | +from common_utils import assert_equal, cpu_and_cuda |
15 | 14 | from torch.utils._pytree import tree_flatten, tree_unflatten
|
16 | 15 | from torchvision import datapoints
|
17 | 16 | from torchvision.ops.boxes import box_iou
|
@@ -1279,55 +1278,6 @@ def test_sanitize_bounding_boxes_errors():
|
1279 | 1278 | transforms.SanitizeBoundingBoxes()(different_sizes)
|
1280 | 1279 |
|
1281 | 1280 |
|
1282 |
| -@pytest.mark.parametrize( |
1283 |
| - "import_statement", |
1284 |
| - ( |
1285 |
| - "from torchvision.transforms import v2", |
1286 |
| - "import torchvision.transforms.v2", |
1287 |
| - "from torchvision.transforms.v2 import Resize", |
1288 |
| - "import torchvision.transforms.v2.functional", |
1289 |
| - "from torchvision.transforms.v2.functional import resize", |
1290 |
| - "from torchvision import datapoints", |
1291 |
| - "from torchvision.datapoints import Image", |
1292 |
| - "from torchvision.datasets import wrap_dataset_for_transforms_v2", |
1293 |
| - ), |
1294 |
| -) |
1295 |
| -@pytest.mark.parametrize("call_disable_warning", (True, False)) |
1296 |
| -def test_warnings_v2_namespaces(import_statement, call_disable_warning): |
1297 |
| - if call_disable_warning: |
1298 |
| - source = f""" |
1299 |
| - import warnings |
1300 |
| - import torchvision |
1301 |
| - torchvision.disable_beta_transforms_warning() |
1302 |
| - with warnings.catch_warnings(): |
1303 |
| - warnings.simplefilter("error") |
1304 |
| - {import_statement} |
1305 |
| - """ |
1306 |
| - else: |
1307 |
| - source = f""" |
1308 |
| - import pytest |
1309 |
| - with pytest.warns(UserWarning, match="v2 namespaces are still Beta"): |
1310 |
| - {import_statement} |
1311 |
| - """ |
1312 |
| - assert_run_python_script(textwrap.dedent(source)) |
1313 |
| - |
1314 |
| - |
1315 |
| -def test_no_warnings_v1_namespace(): |
1316 |
| - source = """ |
1317 |
| - import warnings |
1318 |
| - with warnings.catch_warnings(): |
1319 |
| - warnings.simplefilter("error") |
1320 |
| - import torchvision.transforms |
1321 |
| - from torchvision import transforms |
1322 |
| - import torchvision.transforms.functional |
1323 |
| - from torchvision.transforms import Resize |
1324 |
| - from torchvision.transforms.functional import resize |
1325 |
| - from torchvision import datasets |
1326 |
| - from torchvision.datasets import ImageNet |
1327 |
| - """ |
1328 |
| - assert_run_python_script(textwrap.dedent(source)) |
1329 |
| - |
1330 |
| - |
1331 | 1281 | class TestLambda:
|
1332 | 1282 | inputs = pytest.mark.parametrize("input", [object(), torch.empty(()), np.empty(()), "string", 1, 0.0])
|
1333 | 1283 |
|
|
0 commit comments