mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-22 07:10:34 +08:00
PyTorch 1.4 compat
Summary: Restore compatibility with PyTorch 1.4 and 1.5, and a few lint fixes. Reviewed By: patricklabatut Differential Revision: D30048115 fbshipit-source-id: ee05efa7c625f6079fb06a3cc23be93e48df9433
This commit is contained in:
committed by
Facebook GitHub Bot
parent
55aaec4d83
commit
5ecce83217
@@ -140,8 +140,10 @@ def matrix_to_quaternion(matrix: torch.Tensor) -> torch.Tensor:
|
||||
dim=-2,
|
||||
)
|
||||
|
||||
# clipping is not important here; if q_abs is small, the candidate won't be picked
|
||||
quat_candidates = quat_by_rijk / (2.0 * q_abs[..., None].clip(0.1))
|
||||
# We floor here at 0.1 but the exact level is not important; if q_abs is small,
|
||||
# the candidate won't be picked.
|
||||
# pyre-ignore [16]: `torch.Tensor` has no attribute `new_tensor`.
|
||||
quat_candidates = quat_by_rijk / (2.0 * q_abs[..., None].max(q_abs.new_tensor(0.1)))
|
||||
|
||||
# if not for numerical problems, quat_candidates[i] should be same (up to a sign),
|
||||
# forall i; we pick the best-conditioned one (with the largest denominator)
|
||||
|
||||
Reference in New Issue
Block a user