Commit e04d001a authored by panning's avatar panning
Browse files

pytest skip on rocm

parent ceb1a627
Pipeline #244 failed with stages
in 0 seconds
...@@ -8,7 +8,7 @@ from torchvision.datasets.video_utils import VideoClips, unfold ...@@ -8,7 +8,7 @@ from torchvision.datasets.video_utils import VideoClips, unfold
from common_utils import get_tmp_dir from common_utils import get_tmp_dir
from _assert_utils import assert_equal from _assert_utils import assert_equal
import pytest
@contextlib.contextmanager @contextlib.contextmanager
def get_list_of_videos(num_videos=5, sizes=None, fps=None): def get_list_of_videos(num_videos=5, sizes=None, fps=None):
...@@ -81,7 +81,8 @@ class Tester(unittest.TestCase): ...@@ -81,7 +81,8 @@ class Tester(unittest.TestCase):
video_idx, clip_idx = video_clips.get_clip_location(i) video_idx, clip_idx = video_clips.get_clip_location(i)
assert video_idx == v_idx assert video_idx == v_idx
assert clip_idx == c_idx assert clip_idx == c_idx
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
@unittest.skipIf(not io.video._av_available(), "this test requires av") @unittest.skipIf(not io.video._av_available(), "this test requires av")
def test_video_clips_custom_fps(self): def test_video_clips_custom_fps(self):
with get_list_of_videos(num_videos=3, sizes=[12, 12, 12], fps=[3, 4, 6]) as video_list: with get_list_of_videos(num_videos=3, sizes=[12, 12, 12], fps=[3, 4, 6]) as video_list:
......
...@@ -225,7 +225,8 @@ class ImageTester(unittest.TestCase): ...@@ -225,7 +225,8 @@ class ImageTester(unittest.TestCase):
self.assertEqual(content, saved_content) self.assertEqual(content, saved_content)
os.unlink(fpath) os.unlink(fpath)
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
@needs_cuda @needs_cuda
@pytest.mark.parametrize('img_path', [ @pytest.mark.parametrize('img_path', [
pytest.param(jpeg_path, id=_get_safe_image_name(jpeg_path)) pytest.param(jpeg_path, id=_get_safe_image_name(jpeg_path))
...@@ -245,7 +246,8 @@ def test_decode_jpeg_cuda(mode, img_path, scripted): ...@@ -245,7 +246,8 @@ def test_decode_jpeg_cuda(mode, img_path, scripted):
# Some difference expected between jpeg implementations # Some difference expected between jpeg implementations
tester.assertTrue((img.float() - img_nvjpeg.cpu().float()).abs().mean() < 2) tester.assertTrue((img.float() - img_nvjpeg.cpu().float()).abs().mean() < 2)
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
@needs_cuda @needs_cuda
@pytest.mark.parametrize('cuda_device', ('cuda', 'cuda:0', torch.device('cuda'))) @pytest.mark.parametrize('cuda_device', ('cuda', 'cuda:0', torch.device('cuda')))
def test_decode_jpeg_cuda_device_param(cuda_device): def test_decode_jpeg_cuda_device_param(cuda_device):
...@@ -253,7 +255,8 @@ def test_decode_jpeg_cuda_device_param(cuda_device): ...@@ -253,7 +255,8 @@ def test_decode_jpeg_cuda_device_param(cuda_device):
data = read_file(next(get_images(IMAGE_ROOT, ".jpg"))) data = read_file(next(get_images(IMAGE_ROOT, ".jpg")))
decode_jpeg(data, device=cuda_device) decode_jpeg(data, device=cuda_device)
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
@needs_cuda @needs_cuda
def test_decode_jpeg_cuda_errors(): def test_decode_jpeg_cuda_errors():
data = read_file(next(get_images(IMAGE_ROOT, ".jpg"))) data = read_file(next(get_images(IMAGE_ROOT, ".jpg")))
...@@ -358,7 +361,8 @@ def test_write_jpeg_windows(): ...@@ -358,7 +361,8 @@ def test_write_jpeg_windows():
assert_equal(torch_bytes, pil_bytes) assert_equal(torch_bytes, pil_bytes)
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
@cpu_only @cpu_only
@_collect_if(cond=not IS_WINDOWS) @_collect_if(cond=not IS_WINDOWS)
@pytest.mark.parametrize('img_path', [ @pytest.mark.parametrize('img_path', [
...@@ -380,7 +384,8 @@ def test_encode_jpeg(img_path): ...@@ -380,7 +384,8 @@ def test_encode_jpeg(img_path):
encoded_jpeg_torch = encode_jpeg(src_img, quality=75) encoded_jpeg_torch = encode_jpeg(src_img, quality=75)
assert_equal(encoded_jpeg_torch, encoded_jpeg_pil) assert_equal(encoded_jpeg_torch, encoded_jpeg_pil)
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
@cpu_only @cpu_only
@_collect_if(cond=not IS_WINDOWS) @_collect_if(cond=not IS_WINDOWS)
@pytest.mark.parametrize('img_path', [ @pytest.mark.parametrize('img_path', [
......
...@@ -11,7 +11,7 @@ from urllib.error import URLError ...@@ -11,7 +11,7 @@ from urllib.error import URLError
from common_utils import get_tmp_dir from common_utils import get_tmp_dir
from _assert_utils import assert_equal from _assert_utils import assert_equal
import pytest
try: try:
import av import av
...@@ -256,7 +256,8 @@ class TestIO(unittest.TestCase): ...@@ -256,7 +256,8 @@ class TestIO(unittest.TestCase):
# and the last few frames are wrong # and the last few frames are wrong
with self.assertRaises(AssertionError): with self.assertRaises(AssertionError):
assert_equal(video, data) assert_equal(video, data)
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
@unittest.skipIf(sys.platform == 'win32', 'temporarily disabled on Windows') @unittest.skipIf(sys.platform == 'win32', 'temporarily disabled on Windows')
def test_write_video_with_audio(self): def test_write_video_with_audio(self):
f_name = os.path.join(VIDEO_DIR, "R6llTwEh07w.mp4") f_name = os.path.join(VIDEO_DIR, "R6llTwEh07w.mp4")
......
...@@ -23,7 +23,7 @@ except ImportError: ...@@ -23,7 +23,7 @@ except ImportError:
from common_utils import cycle_over, int_dtypes, float_dtypes from common_utils import cycle_over, int_dtypes, float_dtypes
from _assert_utils import assert_equal from _assert_utils import assert_equal
import pytest
GRACE_HOPPER = get_file_path_2( GRACE_HOPPER = get_file_path_2(
os.path.dirname(os.path.abspath(__file__)), 'assets', 'encode_jpeg', 'grace_hopper_517x606.jpg') os.path.dirname(os.path.abspath(__file__)), 'assets', 'encode_jpeg', 'grace_hopper_517x606.jpg')
...@@ -1380,7 +1380,8 @@ class Tester(unittest.TestCase): ...@@ -1380,7 +1380,8 @@ class Tester(unittest.TestCase):
y_np = np.array(y_pil).transpose(2, 0, 1) y_np = np.array(y_pil).transpose(2, 0, 1)
y_th = F.adjust_sharpness(x_th, 2) y_th = F.adjust_sharpness(x_th, 2)
torch.testing.assert_close(y_np, y_th.numpy()) torch.testing.assert_close(y_np, y_th.numpy())
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
def test_adjust_gamma(self): def test_adjust_gamma(self):
x_shape = [2, 2, 3] x_shape = [2, 2, 3]
x_data = [0, 5, 13, 54, 135, 226, 37, 8, 234, 90, 255, 1] x_data = [0, 5, 13, 54, 135, 226, 37, 8, 234, 90, 255, 1]
......
...@@ -11,7 +11,7 @@ from typing import Sequence ...@@ -11,7 +11,7 @@ from typing import Sequence
from common_utils import TransformsTester, get_tmp_dir, int_dtypes, float_dtypes from common_utils import TransformsTester, get_tmp_dir, int_dtypes, float_dtypes
from _assert_utils import assert_equal from _assert_utils import assert_equal
import pytest
NEAREST, BILINEAR, BICUBIC = InterpolationMode.NEAREST, InterpolationMode.BILINEAR, InterpolationMode.BICUBIC NEAREST, BILINEAR, BICUBIC = InterpolationMode.NEAREST, InterpolationMode.BILINEAR, InterpolationMode.BICUBIC
...@@ -516,7 +516,8 @@ class Tester(TransformsTester): ...@@ -516,7 +516,8 @@ class Tester(TransformsTester):
with get_tmp_dir() as tmp_dir: with get_tmp_dir() as tmp_dir:
scripted_fn.save(os.path.join(tmp_dir, "t_norm.pt")) scripted_fn.save(os.path.join(tmp_dir, "t_norm.pt"))
#pan
@pytest.mark.skipif(os.environ.get('PYTORCH_TEST_WITH_ROCM'), reason=('skip on rocm'))
def test_compose(self): def test_compose(self):
tensor, _ = self._create_data(26, 34, device=self.device) tensor, _ = self._create_data(26, 34, device=self.device)
tensor = tensor.to(dtype=torch.float32) / 255.0 tensor = tensor.to(dtype=torch.float32) / 255.0
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment