Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

use reshape instead view to convert matrix from quaternion (#2413)

Edgar Ribabb3fc914f8e1
diff --git a/kornia/geometry/conversions.py b/kornia/geometry/conversions.py
index b2143101a..fd7affdb8 100644
--- a/kornia/geometry/conversions.py
+++ b/kornia/geometry/conversions.py
@@ -419,7 +419,7 @@ def rotation_matrix_to_quaternion(
eps: float = torch.finfo(numerator.dtype).tiny
return numerator / torch.clamp(denominator, min=eps)
- rotation_matrix_vec: Tensor = rotation_matrix.view(*rotation_matrix.shape[:-2], 9)
+ rotation_matrix_vec: Tensor = rotation_matrix.reshape(*rotation_matrix.shape[:-2], 9)
m00, m01, m02, m10, m11, m12, m20, m21, m22 = torch.chunk(rotation_matrix_vec, chunks=9, dim=-1)