code: def random_rotations(
      n: int,
      dtype: Optional[torch.dtype] = None,
      device: Optional[Device] = None,
  ) -> torch.Tensor:
      """
      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:
          Rotation matrices as tensor of shape (n, 3, 3).
      """
      quaternions = random_quaternions(n, dtype=dtype, device=device)
      return quaternion_to_matrix(quaternions)
  
imports: from typing import Optional
  import torch
  import torch.nn.functional
  from ..common.datatypes import Device
label_desc: Use image node_id 11 for calling a global function with example usage: random_rotations(n, dtype, device) and returns: quaternion_to_matrix