Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

Fix current typing errors (#2305)

João Gustavo A. Amorimfd143a8a5f54
diff --git a/kornia/augmentation/_2d/geometric/base.py b/kornia/augmentation/_2d/geometric/base.py
index 237e34ea1..4601b29b8 100644
--- a/kornia/augmentation/_2d/geometric/base.py
+++ b/kornia/augmentation/_2d/geometric/base.py
@@ -138,11 +138,11 @@ class GeometricAugmentationBase2D(RigidAffineAugmentationBase2D):
self._params if params is None else params, flags, **kwargs
)
- size = None
+ size: Optional[Tuple[int, int]] = None
if "forward_input_shape" in params:
# Majorly for cropping functions
- size = params['forward_input_shape'].tolist()
- size = (size[-2], size[-1])
+ _size = params['forward_input_shape'].tolist()
+ size = (_size[-2], _size[-1])
# if no augmentation needed
if not to_apply.any():
diff --git a/kornia/feature/disk/structs.py b/kornia/feature/disk/structs.py
index dbdccab0b..f7b9bd1a9 100644
--- a/kornia/feature/disk/structs.py
+++ b/kornia/feature/disk/structs.py
@@ -1,6 +1,7 @@
from __future__ import annotations
from dataclasses import dataclass
+from typing import Any
import torch.nn.functional as F
@@ -41,7 +42,7 @@ class DISKFeatures:
"""Accesses the y coordinates of keypoints (along image height)."""
return self.keypoints[:, 1]
- def to(self, *args, **kwargs) -> DISKFeatures:
+ def to(self, *args: Any, **kwargs: Any) -> DISKFeatures:
"""Calls :func:`torch.Tensor.to` on each tensor to move the keypoints, descriptors and detection scores to
the specified device and/or data type.