|
2 | 2 | import itertools |
3 | 3 | import math |
4 | 4 | import os |
5 | | -import re |
6 | 5 | from functools import partial |
7 | 6 | from typing import Sequence |
8 | 7 |
|
@@ -144,20 +143,6 @@ def test_rotate_batch(self, device, dt): |
144 | 143 | center = (20, 22) |
145 | 144 | _test_fn_on_batch(batch_tensors, F.rotate, angle=32, interpolation=NEAREST, expand=True, center=center) |
146 | 145 |
|
147 | | - def test_rotate_interpolation_type(self): |
148 | | - tensor, _ = _create_data(26, 26) |
149 | | - # assert changed type warning |
150 | | - with pytest.warns( |
151 | | - UserWarning, |
152 | | - match=re.escape( |
153 | | - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " |
154 | | - "Please use InterpolationMode enum." |
155 | | - ), |
156 | | - ): |
157 | | - res1 = F.rotate(tensor, 45, interpolation=2) |
158 | | - res2 = F.rotate(tensor, 45, interpolation=BILINEAR) |
159 | | - assert_equal(res1, res2) |
160 | | - |
161 | 146 |
|
162 | 147 | class TestAffine: |
163 | 148 |
|
@@ -364,22 +349,6 @@ def test_batches(self, device, dt): |
364 | 349 |
|
365 | 350 | _test_fn_on_batch(batch_tensors, F.affine, angle=-43, translate=[-3, 4], scale=1.2, shear=[4.0, 5.0]) |
366 | 351 |
|
367 | | - @pytest.mark.parametrize("device", cpu_and_gpu()) |
368 | | - def test_warnings(self, device): |
369 | | - tensor, pil_img = _create_data(26, 26, device=device) |
370 | | - |
371 | | - # assert changed type warning |
372 | | - with pytest.warns( |
373 | | - UserWarning, |
374 | | - match=re.escape( |
375 | | - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " |
376 | | - "Please use InterpolationMode enum." |
377 | | - ), |
378 | | - ): |
379 | | - res1 = F.affine(tensor, 45, translate=[0, 0], scale=1.0, shear=[0.0, 0.0], interpolation=2) |
380 | | - res2 = F.affine(tensor, 45, translate=[0, 0], scale=1.0, shear=[0.0, 0.0], interpolation=BILINEAR) |
381 | | - assert_equal(res1, res2) |
382 | | - |
383 | 352 |
|
384 | 353 | def _get_data_dims_and_points_for_perspective(): |
385 | 354 | # Ideally we would parametrize independently over data dims and points, but |
@@ -478,23 +447,6 @@ def test_perspective_batch(device, dims_and_points, dt): |
478 | 447 | ) |
479 | 448 |
|
480 | 449 |
|
481 | | -def test_perspective_interpolation_warning(): |
482 | | - # assert changed type warning |
483 | | - spoints = [[0, 0], [33, 0], [33, 25], [0, 25]] |
484 | | - epoints = [[3, 2], [32, 3], [30, 24], [2, 25]] |
485 | | - tensor = torch.randint(0, 256, (3, 26, 26)) |
486 | | - with pytest.warns( |
487 | | - UserWarning, |
488 | | - match=re.escape( |
489 | | - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " |
490 | | - "Please use InterpolationMode enum." |
491 | | - ), |
492 | | - ): |
493 | | - res1 = F.perspective(tensor, startpoints=spoints, endpoints=epoints, interpolation=2) |
494 | | - res2 = F.perspective(tensor, startpoints=spoints, endpoints=epoints, interpolation=BILINEAR) |
495 | | - assert_equal(res1, res2) |
496 | | - |
497 | | - |
498 | 450 | @pytest.mark.parametrize("device", cpu_and_gpu()) |
499 | 451 | @pytest.mark.parametrize("dt", [None, torch.float32, torch.float64, torch.float16]) |
500 | 452 | @pytest.mark.parametrize( |
@@ -568,19 +520,6 @@ def test_resize_asserts(device): |
568 | 520 |
|
569 | 521 | tensor, pil_img = _create_data(26, 36, device=device) |
570 | 522 |
|
571 | | - # assert changed type warning |
572 | | - with pytest.warns( |
573 | | - UserWarning, |
574 | | - match=re.escape( |
575 | | - "Argument 'interpolation' of type int is deprecated since 0.13 and will be removed in 0.15. " |
576 | | - "Please use InterpolationMode enum." |
577 | | - ), |
578 | | - ): |
579 | | - res1 = F.resize(tensor, size=32, interpolation=2) |
580 | | - |
581 | | - res2 = F.resize(tensor, size=32, interpolation=BILINEAR) |
582 | | - assert_equal(res1, res2) |
583 | | - |
584 | 523 | for img in (tensor, pil_img): |
585 | 524 | exp_msg = "max_size should only be passed if size specifies the length of the smaller edge" |
586 | 525 | with pytest.raises(ValueError, match=exp_msg): |
|
0 commit comments