code: def quaternion_invert(quaternion: torch.Tensor) -> torch.Tensor:
      """
      Given a quaternion representing rotation, get the quaternion representing
      its inverse.
  
      Args:
          quaternion: Quaternions as tensor of shape (..., 4), with real part
              first, which must be versors (unit quaternions).
  
      Returns:
          The inverse, a tensor of quaternions of shape (..., 4).
      """
  
      scaling = torch.tensor([1, -1, -1, -1], device=quaternion.device)
      return quaternion * scaling
  
imports: from typing import Optional
  import torch
  import torch.nn.functional
  from ..common.datatypes import Device
label_desc: Use image node_id 16 for calling a global function with example usage: quaternion_invert(quaternion) and returns: unknown