class_docstr: a wrapper around MNIST to load and cache the transformed data
  once at the beginning of the inference
class_docstr_tok: ["a","wrapper","around","MNIST","to","load","and","cache","the","transformed","data","once","at","the","beginning","of","the","inference"]
docstr: :param index: Index or slice object
  :returns tuple: (image, target) where target is index of the target class.
docstr_tok: [":","param","index",":","Index","or","slice","object",":","returns","tuple",":","(","image",",","target",")","where","target","is","index","of","the","target","class","."]
code: def __getitem__(self, index):
      """
      :param index: Index or slice object
      :returns tuple: (image, target) where target is index of the target class.
      """
      if self.mode in ["sup", "unsup", "valid"]:
          img, target = self.data[index], self.targets[index]
      elif self.mode == "test":
          img, target = self.data[index], self.targets[index]
      else:
          assert False, "invalid mode: {}".format(self.mode)
      return img, target
  
file_path: pyro/examples/vae/utils/mnist_cached.py
imports: import errno
  import os
  from functools import reduce
  import numpy
  import torch
  from torch.utils.data import DataLoader
  from pyro.contrib.examples.util import MNIST, get_data_directory
label_desc: Use image node_id 2 for calling the MNISTCached obj's underlying member method code with example usage: obj.__getitem__(index) and returns: img,  target