Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions test/test_transforms_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ def test_random_crop_video(self):
transforms.ToTensorVideo(),
transforms.RandomCropVideo((oheight, owidth)),
])(clip)
assert result.size(2) == oheight
assert result.size(3) == owidth
self.assertEqual(result.size(2), oheight)
self.assertEqual(result.size(3), owidth)

transforms.RandomCropVideo((oheight, owidth)).__repr__()

Expand All @@ -41,8 +41,8 @@ def test_random_resized_crop_video(self):
transforms.ToTensorVideo(),
transforms.RandomResizedCropVideo((oheight, owidth)),
])(clip)
assert result.size(2) == oheight
assert result.size(3) == owidth
self.assertEqual(result.size(2), oheight)
self.assertEqual(result.size(3), owidth)

transforms.RandomResizedCropVideo((oheight, owidth)).__repr__()

Expand Down Expand Up @@ -110,13 +110,13 @@ def samples_from_standard_normal(tensor):
mean = [clip[c].mean().item() for c in range(channels)]
std = [clip[c].std().item() for c in range(channels)]
normalized = transforms.NormalizeVideo(mean, std)(clip)
assert samples_from_standard_normal(normalized)
self.assertTrue(samples_from_standard_normal(normalized))
random.setstate(random_state)

# Checking the optional in-place behaviour
tensor = torch.rand((3, 128, 16, 16))
tensor_inplace = transforms.NormalizeVideo((0.5, 0.5, 0.5), (0.5, 0.5, 0.5), inplace=True)(tensor)
assert torch.equal(tensor, tensor_inplace)
self.assertTrue(torch.equal(tensor, tensor_inplace))

transforms.NormalizeVideo((0.5, 0.5, 0.5), (0.5, 0.5, 0.5), inplace=True).__repr__()

Expand Down Expand Up @@ -152,7 +152,7 @@ def test_random_horizontal_flip_video(self):

p_value = stats.binom_test(num_horizontal, num_samples, p=0.5)
random.setstate(random_state)
assert p_value > 0.0001
self.assertGreater(p_value, 0.0001)

num_samples = 250
num_horizontal = 0
Expand All @@ -163,7 +163,7 @@ def test_random_horizontal_flip_video(self):

p_value = stats.binom_test(num_horizontal, num_samples, p=0.7)
random.setstate(random_state)
assert p_value > 0.0001
self.assertGreater(p_value, 0.0001)

transforms.RandomHorizontalFlipVideo().__repr__()

Expand Down