Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fixed some checks, and corrected and refactored some docstrings (#1402)

Bharath Rajc3f04c4730d9
diff --git a/kornia/geometry/conversions.py b/kornia/geometry/conversions.py
index f51551e56..7f6133420 100644
--- a/kornia/geometry/conversions.py
+++ b/kornia/geometry/conversions.py
@@ -653,6 +653,7 @@ def quaternion_log_to_exp(
Args:
quaternion: a tensor containing a quaternion to be converted.
The tensor can be of shape :math:`(*, 3)`.
+ eps: a small number for clamping.
order: quaternion coefficient order. Note: 'xyzw' will be deprecated in favor of 'wxyz'.
Return:
@@ -708,7 +709,7 @@ def quaternion_exp_to_log(
Args:
quaternion: a tensor containing a quaternion to be converted.
The tensor can be of shape :math:`(*, 4)`.
- eps: A small number for clamping.
+ eps: a small number for clamping.
order: quaternion coefficient order. Note: 'xyzw' will be deprecated in favor of 'wxyz'.
Return:
diff --git a/kornia/geometry/epipolar/essential.py b/kornia/geometry/epipolar/essential.py
index 239b2bd11..7e3d01c84 100644
--- a/kornia/geometry/epipolar/essential.py
+++ b/kornia/geometry/epipolar/essential.py
@@ -123,7 +123,7 @@ def motion_from_essential(E_mat: torch.Tensor) -> Tuple[torch.Tensor, torch.Tens
The tuple is as following :math:`[(*, 4, 3, 3), (*, 4, 3, 1)]`.
"""
- if not (len(E_mat.shape) >= 2 and E_mat.shape[-2:]):
+ if not (len(E_mat.shape) >= 2 and E_mat.shape[-2:] == (3, 3)):
raise AssertionError(E_mat.shape)
# decompose the essential matrix by its possible poses
@@ -169,7 +169,7 @@ def motion_from_essential_choose_solution(
The tuple is as following :math:`[(*, 3, 3), (*, 3, 1), (*, N, 3)]`.
"""
- if not (len(E_mat.shape) >= 2 and E_mat.shape[-2:]):
+ if not (len(E_mat.shape) >= 2 and E_mat.shape[-2:] == (3, 3)):
raise AssertionError(E_mat.shape)
if not (len(K1.shape) >= 2 and K1.shape[-2:] == (3, 3)):
raise AssertionError(K1.shape)
diff --git a/kornia/geometry/epipolar/numeric.py b/kornia/geometry/epipolar/numeric.py
index f20bc0bd1..4b5482e8f 100644
--- a/kornia/geometry/epipolar/numeric.py
+++ b/kornia/geometry/epipolar/numeric.py
@@ -29,7 +29,7 @@ def cross_product_matrix(x: torch.Tensor) -> torch.Tensor:
def eye_like(n: int, input: torch.Tensor) -> torch.Tensor:
- r"""Return a 2-D tensor with ones on the diagonal and zeros elsewhere with same size as the input.
+ r"""Return a 2-D tensor with ones on the diagonal and zeros elsewhere with the same batch size as the input.
Args:
n: the number of rows :math:`(N)`.
@@ -37,7 +37,7 @@ def eye_like(n: int, input: torch.Tensor) -> torch.Tensor:
The expected shape is :math:`(B, *)`.
Returns:
- The identity matrix with same size as input :math:`(B, N, N)`.
+ The identity matrix with the same batch size as the input :math:`(B, N, N)`.
"""
if n <= 0:
@@ -50,15 +50,15 @@ def eye_like(n: int, input: torch.Tensor) -> torch.Tensor:
def vec_like(n, tensor):
- r"""Return a 2-D tensor with a vector containing zeros with same size as the input.
+ r"""Return a 2-D tensor with a vector containing zeros with the same batch size as the input.
Args:
n: the number of rows :math:`(N)`.
- input: image tensor that will determine the batch size of the output matrix.
+ tensor: image tensor that will determine the batch size of the output matrix.
The expected shape is :math:`(B, *)`.
Returns:
- The vector with same size as input :math:`(B, N, 1)`.
+ The vector with the same batch size as the input :math:`(B, N, 1)`.
"""
if n <= 0: