π Geometric Computer Vision Library for Spatial AI
Python artificial-intelligencecomputer-visiondeep-learninghacktoberfestimage-processingmachine-learningneural-networkpythonpytorchroboticsspatial-ai
Test sequential, coverage
Pau Riba492802685fb2
diff --git a/test/augmentation/test_augmentation.py b/test/augmentation/test_augmentation.pyindex b934099be..928bc80af 100644--- a/test/augmentation/test_augmentation.py+++ b/test/augmentation/test_augmentation.py@@ -164,7 +164,7 @@ class TestColorJitter:assert_allclose(f(input), expected, atol=1e-4, rtol=1e-5)assert_allclose(f1(input)[0], expected, atol=1e-4, rtol=1e-5)- assert_allclose(f1(input)[1], expected_transform, atol=1e-4, rtol=1e-5)+ assert_allclose(f1(input)[1], expected_transform)def test_color_jitter_batch(self):f = ColorJitter()@@ -177,7 +177,7 @@ class TestColorJitter:assert_allclose(f(input), expected, atol=1e-4, rtol=1e-5)assert_allclose(f1(input)[0], expected, atol=1e-4, rtol=1e-5)- assert_allclose(f1(input)[1], expected_transform, atol=1e-4, rtol=1e-5)+ assert_allclose(f1(input)[1], expected_transform)def test_random_brightness(self):torch.manual_seed(42)@@ -587,6 +587,36 @@ class TestColorJitter:assert_allclose(f(input), expected)+ def test_sequential(self):++ f = nn.Sequential(+ ColorJitter(return_transform=True),+ ColorJitter(return_transform=True),+ )++ input = torch.rand(3, 5, 5) # 3 x 5 x 5++ expected = input++ expected_transform = torch.eye(3).unsqueeze(0) # 3 x 3++ assert_allclose(f(input)[0], expected, atol=1e-4, rtol=1e-5)+ assert_allclose(f(input)[1], expected_transform)++ def test_color_jitter_batch(self):+ f = nn.Sequential(+ ColorJitter(return_transform=True),+ ColorJitter(return_transform=True),+ )++ input = torch.rand(2, 3, 5, 5) # 2 x 3 x 5 x 5+ expected = input++ expected_transform = torch.eye(3).unsqueeze(0).expand((2, 3, 3)) # 2 x 3 x 3++ assert_allclose(f(input)[0], expected, atol=1e-4, rtol=1e-5)+ assert_allclose(f(input)[1], expected_transform)+def test_gradcheck(self):input = torch.rand((3, 5, 5)).double() # 3 x 3