class_docstr: analogous to fairseq.data.indexed_dataset.IndexedCachedDataset.
  Support loading .idx + .bin as fairseq does and also .npz. In self
  initializer if
  (1) path is passed in: call the initializer of parent class and loads
  idx + bin from the path.
  (2) path is None: Initialize an empty class. Call load(path) to load
  .npz data.
  When self.is_npz=True, use the implementation in this class which overrides
  parent methods. Otherwise use parent functions in fairseq.
class_docstr_tok: ["analogous","to","fairseq.data.indexed_dataset.IndexedCachedDataset",".","Support","loading",".idx","+",".bin","as","fairseq","does","and","also",".npz",".","In","self","initializer","if","(","1",")","path","is","passed","in",":","call","the","initializer","of","parent","class","and","loads","idx","+","bin","from","the","path",".","(","2",")","path","is","None",":","Initialize","an","empty","class",".","Call","load","(","path",")","to","load",".npz","data",".","When","self.is_npz=True",",","use","the","implementation","in","this","class","which","overrides","parent","methods",".","Otherwise","use","parent","functions","in","fairseq","."]
code: def reverse(self, eos_token=True):
      for i in range(len(self.offsets) - 1):
          start_offset = self.offsets[i]
          end_offset = (
              self.offsets[i + 1] - 1
              if eos_token
              else self.offsets[i + 1]
          )
  
          self.buffer[start_offset:end_offset] = self.buffer[
              start_offset:end_offset
          ][::-1]
  
imports: import os
  import shutil
  import tempfile
  from typing import Dict, NamedTuple, Optional
  import numpy
  import torch
  from fairseq import data, tokenizer
  from fvcore.common.file_io import PathManager
  from pytorch_translate import constants
  from pytorch_translate.data import dictionary
label_desc: Use image node_id 6 for calling the InMemoryIndexedDataset obj's underlying member method code with example usage: obj.reverse(eos_token) without return types