Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

make missing apply function private

edgarriba912cd58348b7
diff --git a/kornia/augmentation/__init__.py b/kornia/augmentation/__init__.py
index 1d51dcf5c..e53489d0a 100644
--- a/kornia/augmentation/__init__.py
+++ b/kornia/augmentation/__init__.py
@@ -7,6 +7,7 @@ __all__ = [
"RandomRectangleErasing",
"RandomGrayscale",
"ColorJitter",
+ "RandomRotation",
"RandomCrop",
"RandomResizedCrop"
]
diff --git a/kornia/augmentation/augmentation.py b/kornia/augmentation/augmentation.py
index a0859f61b..ac5af2a2e 100644
--- a/kornia/augmentation/augmentation.py
+++ b/kornia/augmentation/augmentation.py
@@ -410,7 +410,7 @@ class RandomRotation(AugmentationBase):
"""
def __init__(self, degrees: FloatUnionType = 45.0, return_transform: bool = False) -> None:
- super(RandomRotation, self).__init__(F.apply_rotation, return_transform)
+ super(RandomRotation, self).__init__(F._apply_rotation, return_transform)
self.degrees = degrees
self._params: Dict[str, torch.Tensor] = {}
@@ -454,7 +454,7 @@ class RandomCrop(AugmentationBase):
def __init__(self, size: Tuple[int, int], padding: Optional[BoarderUnionType] = None,
pad_if_needed: Optional[bool] = False, fill=0, padding_mode='constant',
return_transform: bool = False) -> None:
- super(RandomCrop, self).__init__(F.apply_crop, return_transform)
+ super(RandomCrop, self).__init__(F._apply_crop, return_transform)
self.size = size
self.padding = padding
self.pad_if_needed = pad_if_needed
@@ -520,7 +520,7 @@ class RandomResizedCrop(AugmentationBase):
def __init__(self, size: Tuple[int, int], scale=(1.0, 1.0), ratio=(1.0, 1.0),
interpolation=None, return_transform: bool = False) -> None:
- super(RandomResizedCrop, self).__init__(F.apply_crop, return_transform)
+ super(RandomResizedCrop, self).__init__(F._apply_crop, return_transform)
self.size = size
self.scale = scale
self.ratio = ratio
diff --git a/kornia/augmentation/functional.py b/kornia/augmentation/functional.py
index dfa6eb786..124b550f7 100644
--- a/kornia/augmentation/functional.py
+++ b/kornia/augmentation/functional.py
@@ -169,7 +169,7 @@ def random_rotation(input: torch.Tensor, degrees: FloatUnionType, return_transfo
params = pg._random_rotation_gen(batch_size, degrees=degrees)
- return apply_rotation(input, params, return_transform)
+ return _apply_rotation(input, params, return_transform)
def _apply_hflip(input: torch.Tensor, params: Dict[str, torch.Tensor], return_transform: bool = False) -> UnionType:
@@ -466,7 +466,7 @@ def _apply_center_crop(input: torch.Tensor,
return center_crop(input, (size1, size2), return_transform)
-def apply_rotation(input: torch.Tensor, params: Dict[str, torch.Tensor], return_transform: bool = False):
+def _apply_rotation(input: torch.Tensor, params: Dict[str, torch.Tensor], return_transform: bool = False):
r"""Rotate a tensor image or a batch of tensor images a random amount of degrees.
Input should be a tensor of shape (C, H, W) or a batch of tensors :math:`(*, C, H, W)`.
@@ -505,7 +505,7 @@ def apply_rotation(input: torch.Tensor, params: Dict[str, torch.Tensor], return_
return transformed
-def apply_crop(input: torch.Tensor, params: Dict[str, torch.Tensor], return_transform: bool = False) -> UnionType:
+def _apply_crop(input: torch.Tensor, params: Dict[str, torch.Tensor], return_transform: bool = False) -> UnionType:
"""
Args:
params (dict): A dict that must have {'src': torch.Tensor, 'dst': torch.Tensor}. Can be generated from