Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fix bug in transformation matrix

dvd420c37e8359cf2
diff --git a/kornia/augmentation/augmentations.py b/kornia/augmentation/augmentations.py
index 7b5ccede6..2f4affe2e 100644
--- a/kornia/augmentation/augmentations.py
+++ b/kornia/augmentation/augmentations.py
@@ -75,7 +75,7 @@ def random_hflip(input: torch.Tensor, p: float = 0.5, return_transformation: boo
w: int = input.shape[-2]
flip_mat: torch.Tensor = torch.tensor([[-1, 0, w],
[0, 1, 0],
- [0, 0, 0]])
+ [0, 0, 1]])
trans_mat[to_flip] = flip_mat.to(device).to(dtype)
diff --git a/test/augmentation/test_augmentation.py b/test/augmentation/test_augmentation.py
index cc243f958..51532fd4e 100644
--- a/test/augmentation/test_augmentation.py
+++ b/test/augmentation/test_augmentation.py
@@ -32,7 +32,7 @@ class TestRandomHorizontalFlip:
expected_transform = torch.tensor([[-1., 0., 3.],
[0., 1., 0.],
- [0., 0., 0.]]) # 3 x 3
+ [0., 0., 1.]]) # 3 x 3
identity = torch.tensor([[1., 0., 0.],
[0., 1., 0.],
@@ -60,7 +60,7 @@ class TestRandomHorizontalFlip:
expected_transform = torch.tensor([[[-1., 0., 3.],
[0., 1., 0.],
- [0., 0., 0.]]]) # 1 x 3 x 3
+ [0., 0., 1.]]]) # 1 x 3 x 3
identity = torch.tensor([[[1., 0., 0.],
[0., 1., 0.],