Skip to content

Commit 7eb3c39

Browse files
alex-benebottler
andauthored
avoid big temporary tensor creation in matrix_to_axis_angle
Co-authored-by: Jeremy Reizenstein <[email protected]>
1 parent ef23375 commit 7eb3c39

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pytorch3d/transforms/rotation_conversions.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -542,7 +542,7 @@ def matrix_to_axis_angle(matrix: torch.Tensor, fast: bool = False) -> torch.Tens
542542
zeros = torch.zeros(3, dtype=matrix.dtype, device=matrix.device)
543543
omegas = torch.where(torch.isclose(angles, torch.zeros_like(angles)), zeros, omegas)
544544

545-
near_pi = torch.isclose(angles, torch.full_like(angles, torch.pi)).squeeze(-1)
545+
near_pi = angles.isclose(angles.new_tensor(torch.pi)).squeeze(-1)
546546

547547
axis_angles = torch.empty_like(omegas)
548548
axis_angles[~near_pi] = (

0 commit comments

Comments
 (0)