Convert axis_angle to quaternions. Args: axis_angle (Union[torch.Tensor, numpy.ndarray]): input shape should be (..., 3). ndim of input is unlimited. Returns: Union[torch.Tensor, numpy.ndarray]: shape would be (..., 4).
(
axis_angle: Union[torch.Tensor, numpy.ndarray]
)
| 90 | |
| 91 | |
| 92 | def aa_to_quat( |
| 93 | axis_angle: Union[torch.Tensor, numpy.ndarray] |
| 94 | ) -> Union[torch.Tensor, numpy.ndarray]: |
| 95 | """ |
| 96 | Convert axis_angle to quaternions. |
| 97 | Args: |
| 98 | axis_angle (Union[torch.Tensor, numpy.ndarray]): input shape |
| 99 | should be (..., 3). ndim of input is unlimited. |
| 100 | |
| 101 | Returns: |
| 102 | Union[torch.Tensor, numpy.ndarray]: shape would be (..., 4). |
| 103 | """ |
| 104 | if axis_angle.shape[-1] != 3: |
| 105 | raise ValueError(f'Invalid input axis angles f{axis_angle.shape}.') |
| 106 | t = Compose([axis_angle_to_quaternion]) |
| 107 | return t(axis_angle) |
| 108 | |
| 109 | |
| 110 | def ee_to_rotmat(euler_angle: Union[torch.Tensor, numpy.ndarray], |