Skip to content

Commit 3087ab7

Browse files
Standardize matrix_to_quaternion output
Summary: An OSS user has pointed out in #1703 that the output of matrix_to_quaternion (in that file) can be non standardized. This diff solves the issue by adding a line of standardize at the end of the function Reviewed By: bottler Differential Revision: D52368721 fbshipit-source-id: c8d0426307fcdb7fd165e032572382d5ae360cde
1 parent e46ab49 commit 3087ab7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pytorch3d/transforms/rotation_conversions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,10 +155,10 @@ def matrix_to_quaternion(matrix: torch.Tensor) -> torch.Tensor:
155155

156156
# if not for numerical problems, quat_candidates[i] should be same (up to a sign),
157157
# forall i; we pick the best-conditioned one (with the largest denominator)
158-
159-
return quat_candidates[
158+
out = quat_candidates[
160159
F.one_hot(q_abs.argmax(dim=-1), num_classes=4) > 0.5, :
161160
].reshape(batch_dim + (4,))
161+
return standardize_quaternion(out)
162162

163163

164164
def _axis_angle_rotation(axis: str, angle: torch.Tensor) -> torch.Tensor:

0 commit comments

Comments
 (0)