Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Stop the RandomRotation90 doctest asserting on float32 noise

Edgar Ribaea1d741d9262
diff --git a/kornia/augmentation/_2d/geometric/rotation.py b/kornia/augmentation/_2d/geometric/rotation.py
index 49845b0e7..5e335b6eb 100644
--- a/kornia/augmentation/_2d/geometric/rotation.py
+++ b/kornia/augmentation/_2d/geometric/rotation.py
@@ -165,11 +165,11 @@ class RandomRotation90(GeometricAugmentationBase2D):
... [0., 0., 1., 2.]])
>>> aug = RandomRotation90(times=(1, 1), p=1.)
>>> out = aug(input)
- >>> out
- tensor([[[[2.0000e+00, 0.0000e+00, 0.0000e+00, 2.0000e+00],
- [0.0000e+00, 0.0000e+00, 2.0000e+00, 1.0000e+00],
- [5.9605e-08, 0.0000e+00, 1.0000e+00, 0.0000e+00],
- [1.0000e+00, 5.9605e-08, 0.0000e+00, 0.0000e+00]]]])
+ >>> out.round() # rounded: the warp leaves float32 noise around 1e-7
+ tensor([[[[2., 0., 0., 2.],
+ [0., 0., 2., 1.],
+ [0., 0., 1., 0.],
+ [1., 0., 0., 0.]]]])
>>> aug.transform_matrix
tensor([[[-4.3711e-08, 1.0000e+00, 1.1921e-07],
[-1.0000e+00, -4.3711e-08, 3.0000e+00],