class_docstr: analogous to fairseq.data.IndexedCachedDataset
docstr: Subsample dataset to include only those items indexed by input
  argument indices.
docstr_tok: ["Subsample","dataset","to","include","only","those","items","indexed","by","input","argument","indices","."]
code: def subsample(self, indices):
      """
      Subsample dataset to include only those items indexed by input
      argument indices.
      """
      word_array_list = []
      word_offsets = [0]
      char_array_list = []
      char_offsets = [0]
      sizes = []
      for i in indices:
          word_inds = self.word_buffer[
              self.word_offsets[i] : self.word_offsets[i + 1]
          ]
          word_array_list.append(word_inds)
          word_offsets.append(word_offsets[-1] + len(word_inds))
          sizes.append(len(word_inds))
  
          for word_index in range(
              self.word_offsets[i], self.word_offsets[i + 1]
          ):
              char_inds = self.char_buffer[
                  self.char_offsets[word_index] : self.char_offsets[
                      word_index + 1
                  ]
              ]
              char_array_list.append(char_inds)
              char_offsets.append(char_offsets[-1] + len(char_inds))
  
      self.word_buffer = np.concatenate(word_array_list)
      self.word_offsets = np.array(word_offsets, dtype=np.int32)
      self.char_buffer = np.concatenate(char_array_list)
      self.char_offsets = np.array(char_offsets, dtype=np.int32)
      self.sizes = np.array(sizes, dtype=np.int32)
  
imports: from typing import Any, Dict
  import numpy
  import torch
  from fairseq import data, tokenizer
  from fvcore.common.file_io import PathManager
  from pytorch_translate import vocab_constants
  from pytorch_translate.data.dictionary import TAGS
label_desc: Use image node_id 13 for calling the InMemoryNumpyWordCharDataset obj's underlying member method code with example usage: obj.subsample(indices) without return types