MCPcopy Create free account
hub / github.com/MotrixLab/AiOS / quat_to_aa

Function quat_to_aa

detrsmpl/utils/transforms.py:187–201  ·  view source on GitHub ↗

Convert quaternions to axis angles. Args: quaternions (Union[torch.Tensor, numpy.ndarray]): input shape should be (..., 3). ndim of input is unlimited. Returns: Union[torch.Tensor, numpy.ndarray]: shape would be (..., 3).

(
    quaternions: Union[torch.Tensor, numpy.ndarray]
)

Source from the content-addressed store, hash-verified

185
186
187def quat_to_aa(
188 quaternions: Union[torch.Tensor, numpy.ndarray]
189) -> Union[torch.Tensor, numpy.ndarray]:
190 """Convert quaternions to axis angles.
191
192 Args:
193 quaternions (Union[torch.Tensor, numpy.ndarray]): input shape
194 should be (..., 3). ndim of input is unlimited.
195 Returns:
196 Union[torch.Tensor, numpy.ndarray]: shape would be (..., 3).
197 """
198 if quaternions.shape[-1] != 4:
199 raise ValueError(f'Invalid input quaternions f{quaternions.shape}.')
200 t = Compose([quaternion_to_axis_angle])
201 return t(quaternions)
202
203
204def quat_to_rotmat(

Callers

nothing calls this directly

Calls 1

ComposeClass · 0.70

Tested by

no test coverage detected