@@ -1701,19 +1701,19 @@ def test_beta_cuda_interface_backwards(self, asset, seek_mode):
17011701 assert beta_frame .duration_seconds == ref_frame .duration_seconds
17021702
17031703 @needs_cuda
1704- def test_beta_cuda_interface_small_h265 (self ):
1705- # Test to illustrate current difference in behavior between the BETA and
1706- # the ffmpeg interface: this video isn't supported by NVDEC, but in the
1707- # ffmpeg interface, FFMPEG fallsback to the CPU while we don't.
1708-
1709- print ()
1710- a = VideoDecoder ( H265_VIDEO . path , device = "cuda" ). get_frame_at ( 0 )
1711- # with pytest.raises(
1712- # RuntimeError,
1713- # match="Video is too small in at least one dimension. Provided: 128x128 vs supported:144x144",
1714- # ):
1715- b = VideoDecoder ( H265_VIDEO . path , device = "cuda:0:beta" ). get_frame_at ( 0 )
1716- torch .testing .assert_close (a .data , b .data , rtol = 0 , atol = 0 )
1704+ def test_beta_cuda_interface_cpu_fallback (self ):
1705+ # Non-regression test for the CPU fallback behavior of the BETA CUDA
1706+ # interface.
1707+ # We know that the H265_VIDEO asset isn't supported by NVDEC, its
1708+ # dimensions are too small. We also know that the FFmpeg CUDA interface
1709+ # fallbacks to the CPU path in such cases. We assert that we fall back
1710+ # to the CPU path, too.
1711+
1712+ ffmpeg = VideoDecoder ( H265_VIDEO . path , device = "cuda" ). get_frame_at ( 0 )
1713+ with set_cuda_backend ( "beta" ):
1714+ beta = VideoDecoder ( H265_VIDEO . path , device = "cuda" ). get_frame_at ( 0 )
1715+
1716+ torch .testing .assert_close (ffmpeg .data , beta .data , rtol = 0 , atol = 0 )
17171717
17181718 @needs_cuda
17191719 def test_beta_cuda_interface_error (self ):
@@ -1739,20 +1739,25 @@ def test_set_cuda_backend(self):
17391739 assert _get_cuda_backend () == "beta"
17401740
17411741 def assert_decoder_uses (decoder , * , expected_backend ):
1742+ # TODO: This doesn't work anymore after
1743+ # https://github.com/meta-pytorch/torchcodec/pull/977
1744+ # We need to define a better way to assert which backend a decoder
1745+ # is using.
1746+ return
17421747 # Assert that a decoder instance is using a given backend.
17431748 #
17441749 # We know H265_VIDEO fails on the BETA backend while it works on the
17451750 # ffmpeg one.
1746- if expected_backend == "ffmpeg" :
1747- decoder .get_frame_at (0 ) # this would fail if this was BETA
1748- else :
1749- with pytest .raises (RuntimeError , match = "Video is too small" ):
1750- decoder .get_frame_at (0 )
1751+ # if expected_backend == "ffmpeg":
1752+ # decoder.get_frame_at(0) # this would fail if this was BETA
1753+ # else:
1754+ # with pytest.raises(RuntimeError, match="Video is too small"):
1755+ # decoder.get_frame_at(0)
17511756
17521757 # Check that the default is the ffmpeg backend
17531758 assert _get_cuda_backend () == "ffmpeg"
17541759 dec = VideoDecoder (H265_VIDEO .path , device = "cuda" )
1755- assert_decoder_uses (dec , expected_backend = "ffmpeg" )
1760+ # assert_decoder_uses(dec, expected_backend="ffmpeg")
17561761
17571762 # Check the setting "beta" effectively uses the BETA backend.
17581763 # We also show that the affects decoder creation only. When the decoder
0 commit comments