code: def quaternion_to_axis_angle(
      quaternions: torch.Tensor,
  ) -> torch.Tensor:
      """
      Convert rotations given as quaternions to axis/angle.
  
      Args:
          quaternions: quaternions with real part first,
              as tensor of shape (..., 4).
  
      Returns:
          Rotations given as a vector in axis angle form, as a tensor
              of shape (..., 3), where the magnitude is the angle
              turned anticlockwise in radians around the vector's
              direction.
      """
      norms = torch.norm(
          quaternions[..., 1:], p=2, dim=-1, keepdim=True
      )
      half_angles = torch.atan2(norms, quaternions[..., :1])
      angles = 2 * half_angles
      eps = 1e-6
      small_angles = angles.abs() < eps
      sin_half_angles_over_angles = torch.empty_like(angles)
      sin_half_angles_over_angles[~small_angles] = (
          torch.sin(half_angles[~small_angles]) / angles[~small_angles]
      )
      # for x small, sin(x/2) is about x/2 - (x/2)^3/6
      # so sin(x/2)/x is about 1/2 - (x*x)/48
      sin_half_angles_over_angles[small_angles] = (
          0.5 - (angles[small_angles] * angles[small_angles]) / 48
      )
      return quaternions[..., 1:] / sin_half_angles_over_angles
  
imports: from typing import Optional
  import torch
  import torch.nn.functional
  from ..common.datatypes import Device
label_desc: Use image node_id 21 for calling a global function with example usage: quaternion_to_axis_angle(quaternions) and returns: unknown