original_docstring: Write optical flow to a file.
  
      Supported are several common formats used to store optical flow data:
  
      - KITTI
      - Middlebury
      - PFM
  
      Args:
          flow: the optical flow array or tensor of shape (2, H, W)
          file: a file path to where the contents will be written
          fmt: name of the format in which optical flow is stored
  
      Raises:
          ValueError: If the given format string is not among the supported choices: kitti, middlebury, pfm.
      
docstring: Write optical flow to a file.
  Supported are several common formats used to store optical flow data.
  
  KITTI
  Middlebury
  PFM
docstring_tokens: Write optical flow to a file . Supported are several common formats used to store optical flow data . KITTI Middlebury PFM
code: def write(file: Union[str, Path], flow: Tensor, fmt="middlebury") -> None:
      """Write optical flow to a file.
  
      Supported are several common formats used to store optical flow data:
  
      - KITTI
      - Middlebury
      - PFM
  
      Args:
          flow: the optical flow array or tensor of shape (2, H, W)
          file: a file path to where the contents will be written
          fmt: name of the format in which optical flow is stored
  
      Raises:
          ValueError: If the given format string is not among the supported choices: kitti, middlebury, pfm.
      """
      flow = flow.cpu()
      assert flow.ndim == 3
      assert flow.shape[0] == 2
  
      if fmt == "kitti":
          write_kitti(file, flow)
      elif fmt == "middlebury":
          write_middlebury(file, flow)
      elif fmt == "pfm":
          write_pfm(file, flow)
      else:
          raise ValueError(f"Unknown format: {fmt}")
code_tokens: def write ( file : Union [ str , Path ] , flow : Tensor , fmt = "middlebury" ) -> None : flow = flow . cpu ( ) assert flow . ndim == 3 assert flow . shape [ 0 ] == 2 if fmt == "kitti" : write_kitti ( file , flow ) elif fmt == "middlebury" : write_middlebury ( file , flow ) elif fmt == "pfm" : write_pfm ( file , flow ) else : raise ValueError ( f"Unknown format: {fmt}" )
short_docstring: Write optical flow to a file.
short_docstring_tokens: Write optical flow to a file .
comment: """Write optical flow to a file.
  
      Supported are several common formats used to store optical flow data:
  
      - KITTI
      - Middlebury
      - PFM
  
      Args:
          flow: the optical flow array or tensor of shape (2, H, W)
          file: a file path to where the contents will be written
          fmt: name of the format in which optical flow is stored
  
      Raises:
          ValueError: If the given format string is not among the supported choices: kitti, middlebury, pfm.
      """