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]
)
| 185 | |
| 186 | |
| 187 | def 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 | |
| 204 | def quat_to_rotmat( |