Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

test(augmentation): cover the full-forward compile path for flips (#3811)

Edgar Ribab67bdb0b38c8
diff --git a/tests/augmentation/test_augmentation.py b/tests/augmentation/test_augmentation.py
index e07fb3c07..6a7572c6d 100644
--- a/tests/augmentation/test_augmentation.py
+++ b/tests/augmentation/test_augmentation.py
@@ -889,6 +889,10 @@ class TestRandomHorizontalFlip(BaseTester):
expected = op(input, params=params)
compiled = torch.compile(op, fullgraph=True)
self.assert_close(compiled(input, params=params), expected)
+ # Also compile the full forward (parameters generated internally) so the
+ # parameter-generation path is fullgraph too, not just apply_transform.
+ torch._dynamo.reset()
+ assert torch.compile(RandomHorizontalFlip(p=1.0), fullgraph=True)(input).shape == input.shape
def test_random_hflip(self, device, dtype):
f = RandomHorizontalFlip(p=1.0, keepdim=True)
@@ -1077,6 +1081,10 @@ class TestRandomVerticalFlip(BaseTester):
expected = op(input, params=params)
compiled = torch.compile(op, fullgraph=True)
self.assert_close(compiled(input, params=params), expected)
+ # Also compile the full forward (parameters generated internally) so the
+ # parameter-generation path is fullgraph too, not just apply_transform.
+ torch._dynamo.reset()
+ assert torch.compile(RandomVerticalFlip(p=1.0), fullgraph=True)(input).shape == input.shape
def test_random_vflip(self, device, dtype):
f = RandomVerticalFlip(p=1.0)