original_docstring: Read optical flow data from a file.
  
      Supported are several common formats used to store optical flow data:
  
      - KITTI
      - Middlebury
      - PFM
  
      Args:
          file: path to a file to read the contents from
          fmt: name of the format in which optical flow is stored
          **kwargs: format-specific keyword arguments, which get passed down to the specific loading function if they
              support it
  
      Returns:
          Optical flow in a torch tensor of shape (2, H, W).
  
      Raises:
          ValueError: If the given format string is not among the supported choices: kitti, middlebury, pfm.
      
docstring: Read optical flow data from a file.
  Supported are several common formats used to store optical flow data.
  
  KITTI
  Middlebury
  PFM
docstring_tokens: Read optical flow data from a file . Supported are several common formats used to store optical flow data . KITTI Middlebury PFM
code: def read(file: Union[str, Path], fmt="middlebury", **kwargs: Any) -> Union[Tensor, Any]:
      """Read optical flow data from a file.
  
      Supported are several common formats used to store optical flow data:
  
      - KITTI
      - Middlebury
      - PFM
  
      Args:
          file: path to a file to read the contents from
          fmt: name of the format in which optical flow is stored
          **kwargs: format-specific keyword arguments, which get passed down to the specific loading function if they
              support it
  
      Returns:
          Optical flow in a torch tensor of shape (2, H, W).
  
      Raises:
          ValueError: If the given format string is not among the supported choices: kitti, middlebury, pfm.
      """
      if fmt == "kitti":
          output = read_kitti(file, **kwargs)
      elif fmt == "middlebury":
          output = read_middleburry(file)
      elif fmt == "pfm":
          output = read_pfm(file)
      else:
          raise ValueError(f"Unknown format: {fmt}.")
      return output
code_tokens: def read ( file : Union [ str , Path ] , fmt = "middlebury" , ** kwargs : Any ) -> Union [ Tensor , Any ] : if fmt == "kitti" : output = read_kitti ( file , ** kwargs ) elif fmt == "middlebury" : output = read_middleburry ( file ) elif fmt == "pfm" : output = read_pfm ( file ) else : raise ValueError ( f"Unknown format: {fmt}." ) return output
short_docstring: Read optical flow data from a file.
short_docstring_tokens: Read optical flow data from a file .
comment: """Read optical flow data from a file.
  
      Supported are several common formats used to store optical flow data:
  
      - KITTI
      - Middlebury
      - PFM
  
      Args:
          file: path to a file to read the contents from
          fmt: name of the format in which optical flow is stored
          **kwargs: format-specific keyword arguments, which get passed down to the specific loading function if they
              support it
  
      Returns:
          Optical flow in a torch tensor of shape (2, H, W).
  
      Raises:
          ValueError: If the given format string is not among the supported choices: kitti, middlebury, pfm.
      """