Unverified Commit 74559c47 authored by Nicolas Hug's avatar Nicolas Hug Committed by GitHub
Browse files

Use torch.testing.assert_close in test_video_reader.py (#3888)


Co-authored-by: default avatarPhilip Meier <github.pmeier@posteo.de>
parent 31ee79e6
......@@ -11,6 +11,7 @@ import torchvision.io as io
from numpy.random import randint
from torchvision.io import _HAS_VIDEO_OPT
from common_utils import PY39_SKIP
from _assert_utils import assert_equal
try:
......@@ -359,8 +360,7 @@ class TestVideoReader(unittest.TestCase):
)
self.assertAlmostEqual(mean_delta, 0, delta=1.0)
is_same = torch.all(torch.eq(vtimebase, ref_result.vtimebase)).item()
self.assertEqual(is_same, True)
assert_equal(vtimebase, ref_result.vtimebase)
if (
config.check_aframes
......@@ -369,8 +369,7 @@ class TestVideoReader(unittest.TestCase):
):
"""Audio stream is available and audio frame is required to return
from decoder"""
is_same = torch.all(torch.eq(aframes, ref_result.aframes)).item()
self.assertEqual(is_same, True)
assert_equal(aframes, ref_result.aframes)
if (
config.check_aframe_pts
......@@ -378,11 +377,9 @@ class TestVideoReader(unittest.TestCase):
and ref_result.aframe_pts.numel() > 0
):
"""Audio stream is available"""
is_same = torch.all(torch.eq(aframe_pts, ref_result.aframe_pts)).item()
self.assertEqual(is_same, True)
assert_equal(aframe_pts, ref_result.aframe_pts)
is_same = torch.all(torch.eq(atimebase, ref_result.atimebase)).item()
self.assertEqual(is_same, True)
assert_equal(atimebase, ref_result.atimebase)
@unittest.skip(
"This stress test will iteratively decode the same set of videos."
......
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