Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fixed #785. (#786)

shijianjian2b197e41c2ac
diff --git a/kornia/augmentation/random_generator/random_generator.py b/kornia/augmentation/random_generator/random_generator.py
index db0f2ffe8..a630fd762 100644
--- a/kornia/augmentation/random_generator/random_generator.py
+++ b/kornia/augmentation/random_generator/random_generator.py
@@ -187,7 +187,7 @@ def random_affine_generator(
if scale is not None:
_joint_range_check(cast(torch.Tensor, scale[:2]), "scale")
_scale = _adapted_uniform((batch_size,), scale[0], scale[1], same_on_batch).unsqueeze(1).repeat(1, 2)
- if len(_scale) == 4:
+ if len(scale) == 4:
_joint_range_check(cast(torch.Tensor, scale[2:]), "scale_y")
_scale[:, 1] = _adapted_uniform((batch_size,), scale[2], scale[3], same_on_batch)
else:
diff --git a/test/augmentation/test_random_generator.py b/test/augmentation/test_random_generator.py
index 60ae10c3f..97bb1ae91 100644
--- a/test/augmentation/test_random_generator.py
+++ b/test/augmentation/test_random_generator.py
@@ -274,7 +274,7 @@ class TestRandomPerspectiveGen(RandomGeneratorBaseTests):
class TestRandomAffineGen(RandomGeneratorBaseTests):
- @pytest.mark.parametrize('batch_size', [1, 8])
+ @pytest.mark.parametrize('batch_size', [1, 4])
@pytest.mark.parametrize('height', [200])
@pytest.mark.parametrize('width', [300])
@pytest.mark.parametrize('degrees', [torch.tensor([0, 30])])