class_docstr: A sliceable dataset class that is defined with getters.
  
  This is a dataset class with getters.
  Please refer to the tutorial for more detailed explanation.
  
  Here is an example.
  
  >>> class SliceableLabeledImageDataset(GetterDataset):
  >>>     def __init__(self, pairs, root='.'):
  >>>         super(SliceableLabeledImageDataset, self).__init__()
  >>>         with open(pairs) as f:
  >>>             self._pairs = [l.split() for l in f]
  >>>         self._root = root
  >>>
  >>>         self.add_getter('img', self.get_image)
  >>>         self.add_getter('label', self.get_label)
  >>>
  >>>     def __len__(self):
  >>>         return len(self._pairs)
  >>>
  >>>     def get_image(self, i):
  >>>         path, _ = self._pairs[i]
  >>>         return read_image(os.path.join(self._root, path))
  >>>
  >>>     def get_label(self, i):
  >>>         _, label = self._pairs[i]
  >>>         return np.int32(label)
  >>>
  >>> dataset = SliceableLabeledImageDataset('list.txt')
  >>>
  >>> # get a subset with label = 0, 1, 2
  >>> # no images are loaded
  >>> indices = [i for i, label in
  ...            enumerate(dataset.slice[:, 'label']) if label in {0, 1, 2}]
  >>> dataset_012 = dataset.slice[indices]
class_docstr_tok: ["A","sliceable","dataset","class","that","is","defined","with","getters",".","This","is","a","dataset","class","with","getters",".","Please","refer","to","the","tutorial","for","more","detailed","explanation",".","Here","is","an","example",".",">",">",">","class","SliceableLabeledImageDataset","(","GetterDataset",")",":",">",">",">","def","__init__","(","self",",","pairs",",","root=","'",".","'",")",":",">",">",">","super","(","SliceableLabeledImageDataset",",","self",")",".__init__","(",")",">",">",">","with","open","(","pairs",")","as","f",":",">",">",">","self._pairs","=","[","l.split","(",")","for","l","in","f","]",">",">",">","self._root","=","root",">",">",">",">",">",">","self.add_getter","(","'img","'",",","self.get_image",")",">",">",">","self.add_getter","(","'label","'",",","self.get_label",")",">",">",">",">",">",">","def","__len__","(","self",")",":",">",">",">","return","len","(","self._pairs",")",">",">",">",">",">",">","def","get_image","(","self",",","i",")",":",">",">",">","path",",","_","=","self._pairs","[","i","]",">",">",">","return","read_image","(","os.path.join","(","self._root",",","path",")",")",">",">",">",">",">",">","def","get_label","(","self",",","i",")",":",">",">",">","_",",","label","=","self._pairs","[","i","]",">",">",">","return","np.int32","(","label",")",">",">",">",">",">",">","dataset","=","SliceableLabeledImageDataset","(","'list.txt","'",")",">",">",">",">",">",">","#","get","a","subset","with","label","=","0",",","1",",","2",">",">",">","#","no","images","are","loaded",">",">",">","indices","=","[","i","for","i",",","label","in","...","enumerate","(","dataset.slice","[",":",",","'label","'","]",")","if","label","in","{","0",",","1",",","2","}","]",">",">",">","dataset_012","=","dataset.slice","[","indices","]"]
docstr: Register a getter function
  
  Args:
      keys (string or tuple of strings): The name(s) of data
          that the getter function returns.
      getter (callable): A getter function that takes an index and
          returns data of the corresponding example.
docstr_tok: ["Register","a","getter","function","Args",":","keys","(","string","or","tuple","of","strings",")",":","The","name","(","s",")","of","data","that","the","getter","function","returns",".","getter","(","callable",")",":","A","getter","function","that","takes","an","index","and","returns","data","of","the","corresponding","example","."]
code: def add_getter(self, keys, getter):
      """Register a getter function
  
      Args:
          keys (string or tuple of strings): The name(s) of data
              that the getter function returns.
          getter (callable): A getter function that takes an index and
              returns data of the corresponding example.
      """
      self._getters.append(getter)
      if _is_iterable(keys):
          for key_index, key in enumerate(keys):
              self._keys.append(
                  (key, len(self._getters) - 1, key_index)
              )
      else:
          self._keys.append((keys, len(self._getters) - 1, None))
  
file_path: chainercv/chainercv/chainer_experimental/datasets/sliceable/getter_dataset.py
imports: from chainercv.chainer_experimental.datasets.sliceable.sliceable_dataset import _as_key_indices
  from chainercv.chainer_experimental.datasets.sliceable.sliceable_dataset import _is_iterable
  from chainercv.chainer_experimental.datasets.sliceable import SliceableDataset
label_desc: Use image node_id 5 for calling the GetterDataset obj's underlying member method code with example usage: obj.add_getter(keys, getter) without return types