class_docstr: `Caltech 256 <https://data.caltech.edu/records/20087>`_ Dataset.
  
  Args:
      root (string): Root directory of dataset where directory
          ``caltech256`` exists or will be saved to if download is set to True.
      transform (callable, optional): A function/transform that takes in a PIL image
          and returns a transformed version. E.g, ``transforms.RandomCrop``
      target_transform (callable, optional): A function/transform that takes in the
          target and transforms it.
      download (bool, optional): If true, downloads the dataset from the internet and
          puts it in root directory. If dataset is already downloaded, it is not
          downloaded again.
class_docstr_tok: ["`","Caltech","256","<","https",":","\/\/data.caltech.edu\/records\/20087",">","`","_","Dataset",".","Args",":","root","(","string",")",":","Root","directory","of","dataset","where","directory","``","caltech256","``","exists","or","will","be","saved","to","if","download","is","set","to","True",".","transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","a","PIL","image","and","returns","a","transformed","version",".","E.g",",","``","transforms.RandomCrop","``","target_transform","(","callable",",","optional",")",":","A","function\/transform","that","takes","in","the","target","and","transforms","it",".","download","(","bool",",","optional",")",":","If","true",",","downloads","the","dataset","from","the","internet","and","puts","it","in","root","directory",".","If","dataset","is","already","downloaded",",","it","is","not","downloaded","again","."]
docstr: Args:
      index (int): Index
  
  Returns:
      tuple: (image, target) where target is index of the target class.
docstr_tok: ["Args",":","index","(","int",")",":","Index","Returns",":","tuple",":","(","image",",","target",")","where","target","is","index","of","the","target","class","."]
code: def __getitem__(self, index: int) -> Tuple[Any, Any]:
      """
      Args:
          index (int): Index
  
      Returns:
          tuple: (image, target) where target is index of the target class.
      """
      img = Image.open(
          os.path.join(
              self.root,
              "256_ObjectCategories",
              self.categories[self.y[index]],
              f"{self.y[index] + 1:03d}_{self.index[index]:04d}.jpg",
          )
      )
  
      target = self.y[index]
  
      if self.transform is not None:
          img = self.transform(img)
  
      if self.target_transform is not None:
          target = self.target_transform(target)
  
      return img, target
  
imports: import os
  import os.path
  from typing import Any, Callable, List, Optional, Tuple, Union
  from PIL import Image
  from .utils import download_and_extract_archive, verify_str_arg
  from .vision import VisionDataset
label_desc: Use image node_id 2 for calling the Caltech256 obj's underlying member method code with example usage: obj.__getitem__(index) and returns: img,  target