Generate random rotations as 3x3 rotation matrices. Args: n: Number of rotation matrices in a batch to return. dtype: Type to return. device: Device of returned tensor. Default: if None, uses the current device for the default tensor type. Returns:
(
n: int, dtype: Optional[torch.dtype] = None)
| 456 | |
| 457 | |
| 458 | def random_rotations( |
| 459 | n: int, dtype: Optional[torch.dtype] = None) -> torch.Tensor: |
| 460 | """ |
| 461 | Generate random rotations as 3x3 rotation matrices. |
| 462 | |
| 463 | Args: |
| 464 | n: Number of rotation matrices in a batch to return. |
| 465 | dtype: Type to return. |
| 466 | device: Device of returned tensor. Default: if None, |
| 467 | uses the current device for the default tensor type. |
| 468 | |
| 469 | Returns: |
| 470 | Rotation matrices as tensor of shape (n, 3, 3). |
| 471 | """ |
| 472 | quaternions = random_quaternions(n, dtype=dtype) |
| 473 | return quaternion_to_matrix(quaternions) |
| 474 | |
| 475 | |
| 476 | def quaternion_to_matrix(quaternions: torch.Tensor) -> torch.Tensor: |
nothing calls this directly
no test coverage detected