4545IS_MACOS = sys .platform == "darwin"
4646PILLOW_VERSION = tuple (int (x ) for x in PILLOW_VERSION .split ("." ))
4747WEBP_TEST_IMAGES_DIR = os .environ .get ("WEBP_TEST_IMAGES_DIR" , "" )
48+ IS_ROCM = torch .version .hip is not None
49+ # See https://github.com/pytorch/vision/pull/8724#issuecomment-2503964558
50+ ROCM_WEBP_MESSAGE = "ROCM not built with webp support."
4851
4952# Hacky way of figuring out whether we compiled with libavif/libheif (those are
5053# currenlty disabled by default)
@@ -869,6 +872,7 @@ def test_decode_gif(tmpdir, name, scripted):
869872 (decode_jpeg , "Not a JPEG file" ),
870873 (decode_gif , re .escape ("DGifOpenFileName() failed - 103" )),
871874 (decode_webp , "WebPGetFeatures failed." ),
875+ pytest .param (decode_webp , "WebPGetFeatures failed." , marks = pytest .mark .skipif (IS_ROCM , reason = ROCM_WEBP_MESSAGE )),
872876]
873877if DECODE_AVIF_ENABLED :
874878 decode_fun_and_match .append ((_decode_avif , "BMFF parsing failed" ))
@@ -889,6 +893,7 @@ def test_decode_bad_encoded_data(decode_fun, match):
889893 decode_fun (encoded_data )
890894
891895
896+ @pytest .mark .skipif (IS_ROCM , reason = ROCM_WEBP_MESSAGE )
892897@pytest .mark .parametrize ("decode_fun" , (decode_webp , decode_image ))
893898@pytest .mark .parametrize ("scripted" , (False , True ))
894899def test_decode_webp (decode_fun , scripted ):
@@ -905,6 +910,7 @@ def test_decode_webp(decode_fun, scripted):
905910# including within the repo. The test images were downloaded manually from the
906911# different pages of https://developers.google.com/speed/webp/gallery
907912@pytest .mark .skipif (not WEBP_TEST_IMAGES_DIR , reason = "WEBP_TEST_IMAGES_DIR is not set" )
913+ @pytest .mark .skipif (IS_ROCM , reason = ROCM_WEBP_MESSAGE )
908914@pytest .mark .parametrize ("decode_fun" , (decode_webp , decode_image ))
909915@pytest .mark .parametrize ("scripted" , (False , True ))
910916@pytest .mark .parametrize (
0 commit comments