class_docstr: Wraps a numpy memmap as a datastore for decoder state vectors.
  
  :param file_name: disk file path to store the memory-mapped file
  :param num_dim: number of dimensions of the vectors in the data store
  :param dtype: data type of the vectors in the data store
class_docstr_tok: ["Wraps","a","numpy","memmap","as","a","datastore","for","decoder","state","vectors",".",":","param","file_name",":","disk","file","path","to","store","the","memory-mapped","file",":","param","num_dim",":","number","of","dimensions","of","the","vectors","in","the","data","store",":","param","dtype",":","data","type","of","the","vectors","in","the","data","store"]
docstr: It turns out that numpy memmap actually cannot be re-sized.
  So we have to pre-estimate how many entries we need and put it down as initial_size.
  If we end up adding more entries to the memmap than initially claimed, we'll have to bail out.
  
  :param array: the array of states to be added.
docstr_tok: ["It","turns","out","that","numpy","memmap","actually","can","not","be","re-sized",".","So","we","have","to","pre-estimate","how","many","entries","we","need","and","put","it","down","as","initial_size",".","If","we","end","up","adding","more","entries","to","the","memmap","than","initially","claimed",",","we","'ll","have","to","bail","out",".",":","param","array",":","the","array","of","states","to","be","added","."]
code: def add(self, array: np.ndarray) -> None:
      """
      It turns out that numpy memmap actually cannot be re-sized.
      So we have to pre-estimate how many entries we need and put it down as initial_size.
      If we end up adding more entries to the memmap than initially claimed, we'll have to bail out.
  
      :param array: the array of states to be added.
      """
      assert self.mmap is not None
      num_entries, num_dim = array.shape
      assert num_dim == self.num_dim
  
      if self.tail_idx + num_entries > self.size:
          # bail out
          logger.warning(
              f"Trying to write {num_entries} entries into a numpy memmap that "
              + f"has size {self.size} and already has {self.tail_idx} entries. Nothing is written."
          )
      else:
          start = self.tail_idx
          end = self.tail_idx + num_entries
          self.mmap[start:end] = array
  
          self.tail_idx += num_entries
  
imports: import argparse
  import logging
  import os
  from typing import List, Optional
  import numpy
  import torch
  from .None import arguments
  from .None import constants
  from .None import data_io
  from .None import utils
  from .log import setup_main_logger
  from .model import SockeyeModel, load_model
  from .vocab import Vocab
  from .utils import check_condition
  from .knn import KNNConfig, get_state_store_path, get_word_store_path, get_config_path
label_desc: Use image node_id 3 for calling the NumpyMemmapStorage obj's underlying member method code with example usage: obj.add(array) without return types