Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Make value an attribute of RandomErasing instances as it used to be (#2195)

Miquel Martí1617c9083453
diff --git a/kornia/augmentation/_2d/intensity/erasing.py b/kornia/augmentation/_2d/intensity/erasing.py
index 5d9b08ce4..60de26a73 100644
--- a/kornia/augmentation/_2d/intensity/erasing.py
+++ b/kornia/augmentation/_2d/intensity/erasing.py
@@ -65,7 +65,8 @@ class RandomErasing(IntensityAugmentationBase2D):
super().__init__(p=p, same_on_batch=same_on_batch, keepdim=keepdim)
self.scale = scale
self.ratio = ratio
- self._param_generator = rg.RectangleEraseGenerator(scale, ratio, float(value))
+ self.value = value
+ self._param_generator = rg.RectangleEraseGenerator(scale, ratio, value)
def apply_transform(
self, input: Tensor, params: Dict[str, Tensor], flags: Dict[str, Any], transform: Optional[Tensor] = None