Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
vision
Commits
e04d001a
Commit
e04d001a
authored
Nov 14, 2022
by
panning
Browse files
pytest skip on rocm
parent
ceb1a627
Pipeline
#244
failed with stages
in 0 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
13 deletions
+22
-13
test/test_datasets_video_utils.py
test/test_datasets_video_utils.py
+3
-2
test/test_image.py
test/test_image.py
+10
-5
test/test_io.py
test/test_io.py
+3
-2
test/test_transforms.py
test/test_transforms.py
+3
-2
test/test_transforms_tensor.py
test/test_transforms_tensor.py
+3
-2
No files found.
test/test_datasets_video_utils.py
View file @
e04d001a
...
...
@@ -8,7 +8,7 @@ from torchvision.datasets.video_utils import VideoClips, unfold
from
common_utils
import
get_tmp_dir
from
_assert_utils
import
assert_equal
import
pytest
@
contextlib
.
contextmanager
def
get_list_of_videos
(
num_videos
=
5
,
sizes
=
None
,
fps
=
None
):
...
...
@@ -81,7 +81,8 @@ class Tester(unittest.TestCase):
video_idx
,
clip_idx
=
video_clips
.
get_clip_location
(
i
)
assert
video_idx
==
v_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"
)
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
:
...
...
test/test_image.py
View file @
e04d001a
...
...
@@ -225,7 +225,8 @@ class ImageTester(unittest.TestCase):
self
.
assertEqual
(
content
,
saved_content
)
os
.
unlink
(
fpath
)
#pan
@
pytest
.
mark
.
skipif
(
os
.
environ
.
get
(
'PYTORCH_TEST_WITH_ROCM'
),
reason
=
(
'skip on rocm'
))
@
needs_cuda
@
pytest
.
mark
.
parametrize
(
'img_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):
# Some difference expected between jpeg implementations
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
@
pytest
.
mark
.
parametrize
(
'cuda_device'
,
(
'cuda'
,
'cuda:0'
,
torch
.
device
(
'cuda'
)))
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"
)))
decode_jpeg
(
data
,
device
=
cuda_device
)
#pan
@
pytest
.
mark
.
skipif
(
os
.
environ
.
get
(
'PYTORCH_TEST_WITH_ROCM'
),
reason
=
(
'skip on rocm'
))
@
needs_cuda
def
test_decode_jpeg_cuda_errors
():
data
=
read_file
(
next
(
get_images
(
IMAGE_ROOT
,
".jpg"
)))
...
...
@@ -358,7 +361,8 @@ def test_write_jpeg_windows():
assert_equal
(
torch_bytes
,
pil_bytes
)
#pan
@
pytest
.
mark
.
skipif
(
os
.
environ
.
get
(
'PYTORCH_TEST_WITH_ROCM'
),
reason
=
(
'skip on rocm'
))
@
cpu_only
@
_collect_if
(
cond
=
not
IS_WINDOWS
)
@
pytest
.
mark
.
parametrize
(
'img_path'
,
[
...
...
@@ -380,7 +384,8 @@ def test_encode_jpeg(img_path):
encoded_jpeg_torch
=
encode_jpeg
(
src_img
,
quality
=
75
)
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
@
_collect_if
(
cond
=
not
IS_WINDOWS
)
@
pytest
.
mark
.
parametrize
(
'img_path'
,
[
...
...
test/test_io.py
View file @
e04d001a
...
...
@@ -11,7 +11,7 @@ from urllib.error import URLError
from
common_utils
import
get_tmp_dir
from
_assert_utils
import
assert_equal
import
pytest
try
:
import
av
...
...
@@ -256,7 +256,8 @@ class TestIO(unittest.TestCase):
# and the last few frames are wrong
with
self
.
assertRaises
(
AssertionError
):
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'
)
def
test_write_video_with_audio
(
self
):
f_name
=
os
.
path
.
join
(
VIDEO_DIR
,
"R6llTwEh07w.mp4"
)
...
...
test/test_transforms.py
View file @
e04d001a
...
...
@@ -23,7 +23,7 @@ except ImportError:
from
common_utils
import
cycle_over
,
int_dtypes
,
float_dtypes
from
_assert_utils
import
assert_equal
import
pytest
GRACE_HOPPER
=
get_file_path_2
(
os
.
path
.
dirname
(
os
.
path
.
abspath
(
__file__
)),
'assets'
,
'encode_jpeg'
,
'grace_hopper_517x606.jpg'
)
...
...
@@ -1380,7 +1380,8 @@ class Tester(unittest.TestCase):
y_np
=
np
.
array
(
y_pil
).
transpose
(
2
,
0
,
1
)
y_th
=
F
.
adjust_sharpness
(
x_th
,
2
)
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
):
x_shape
=
[
2
,
2
,
3
]
x_data
=
[
0
,
5
,
13
,
54
,
135
,
226
,
37
,
8
,
234
,
90
,
255
,
1
]
...
...
test/test_transforms_tensor.py
View file @
e04d001a
...
...
@@ -11,7 +11,7 @@ from typing import Sequence
from
common_utils
import
TransformsTester
,
get_tmp_dir
,
int_dtypes
,
float_dtypes
from
_assert_utils
import
assert_equal
import
pytest
NEAREST
,
BILINEAR
,
BICUBIC
=
InterpolationMode
.
NEAREST
,
InterpolationMode
.
BILINEAR
,
InterpolationMode
.
BICUBIC
...
...
@@ -516,7 +516,8 @@ class Tester(TransformsTester):
with
get_tmp_dir
()
as
tmp_dir
:
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
):
tensor
,
_
=
self
.
_create_data
(
26
,
34
,
device
=
self
.
device
)
tensor
=
tensor
.
to
(
dtype
=
torch
.
float32
)
/
255.0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment