class_docstr: `HD1K <http://hci-benchmark.iwr.uni-heidelberg.de/>`__ dataset for optical flow.
  
  The dataset is expected to have the following structure: ::
  
      root
          hd1k
              hd1k_challenge
                  image_2
              hd1k_flow_gt
                  flow_occ
              hd1k_input
                  image_2
  
  Args:
      root (string): Root directory of the HD1K Dataset.
      split (string, optional): The dataset split, either "train" (default) or "test"
      transforms (callable, optional): A function/transform that takes in
          ``img1, img2, flow, valid_flow_mask`` and returns a transformed version.
class_docstr_tok: ["`","HD1K","<","http",":","\/\/hci-benchmark.iwr.uni-heidelberg.de\/",">","`","__","dataset","for","optical","flow",".","The","dataset","is","expected","to","have","the","following","structure",":",":",":","root","hd1k","hd1k_challenge","image_2","hd1k_flow_gt","flow_occ","hd1k_input","image_2","Args",":","root","(","string",")",":","Root","directory","of","the","HD1K","Dataset",".","split","(","string",",","optional",")",":","The","dataset","split",",","either","``","train","''","(","default",")","or","``","test","''","transforms","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","``","img1",",","img2",",","flow",",","valid_flow_mask","``","and","returns","a","transformed","version","."]
docstr: Return example at given index.
  
  Args:
      index(int): The index of the example to retrieve
  
  Returns:
      tuple: A 4-tuple with ``(img1, img2, flow, valid_flow_mask)`` where ``valid_flow_mask``
      is a numpy boolean mask of shape (H, W)
      indicating which flow values are valid. The flow is a numpy array of
      shape (2, H, W) and the images are PIL images. ``flow`` and ``valid_flow_mask`` are None if
      ``split="test"``.
docstr_tok: ["Return","example","at","given","index",".","Args",":","index","(","int",")",":","The","index","of","the","example","to","retrieve","Returns",":","tuple",":","A","4-tuple","with","``","(","img1",",","img2",",","flow",",","valid_flow_mask",")","``","where","``","valid_flow_mask","``","is","a","numpy","boolean","mask","of","shape","(","H",",","W",")","indicating","which","flow","values","are","valid",".","The","flow","is","a","numpy","array","of","shape","(","2",",","H",",","W",")","and","the","images","are","PIL","images",".","``","flow","``","and","``","valid_flow_mask","``","are","None","if","``","split=","''","test","''","``","."]
code: def __getitem__(self, index: int) -> Union[T1, T2]:
      """Return example at given index.
  
      Args:
          index(int): The index of the example to retrieve
  
      Returns:
          tuple: A 4-tuple with ``(img1, img2, flow, valid_flow_mask)`` where ``valid_flow_mask``
          is a numpy boolean mask of shape (H, W)
          indicating which flow values are valid. The flow is a numpy array of
          shape (2, H, W) and the images are PIL images. ``flow`` and ``valid_flow_mask`` are None if
          ``split="test"``.
      """
      return super().__getitem__(index)
  
imports: import itertools
  import os
  from abc import ABC, abstractmethod
  from glob import glob
  from pathlib import Path
  from typing import Callable, List, Optional, Tuple, Union
  import numpy
  import torch
  from PIL import Image
  from ..io.image import _read_png_16
  from .utils import _read_pfm, verify_str_arg
  from .vision import VisionDataset
label_desc: Use image node_id 3 for calling the HD1K obj's underlying member method code with example usage: obj.__getitem__(index) and returns: super