code: def test_numpy_memmap_storage():
      # test open
      with tempfile.TemporaryDirectory() as memmap_dir:
          memmap_file = os.path.join(memmap_dir, "foo")
          store = NumpyMemmapStorage(memmap_file, 64, np.float16)
          store.open(64, 8)
  
          # test add
          ones_block_16 = np.ones((16, 64), dtype=np.float16)
          ones_block_32 = np.ones((32, 64), dtype=np.float16)
          zeros_block_16 = np.zeros((16, 64), dtype=np.float16)
          zeros_block_32 = np.zeros((32, 64), dtype=np.float16)
          # add for 0-15
          store.add(ones_block_16)
          assert (store.mmap[:16, :] == ones_block_16).all()
          assert (store.mmap[16:32, :] == zeros_block_16).all()
          assert (store.mmap[32:, :] == zeros_block_32).all()
          # add for 16-31
          store.add(ones_block_16)
          assert (store.mmap[:32, :] == ones_block_32).all()
          assert (store.mmap[32:, :] == zeros_block_32).all()
          # add with size overflow -- this should trigger a warning without doing anything
          store.add(np.ones((64, 64), dtype=np.float16))
          assert (store.mmap[:32, :] == ones_block_32).all()
          assert (store.mmap[32:, :] == zeros_block_32).all()
  
file_path: sockeye/test/unit/test_knn.py
imports: import numpy
  import os
  import pytest
  import tempfile
  import torch
  import sockeye
  import sockeye.constants
  from sockeye.generate_decoder_states import NumpyMemmapStorage, DecoderStateGenerator
  from sockeye.knn import KNNConfig, FaissIndexBuilder, get_config_path, get_state_store_path, get_word_store_path
  from sockeye.vocab import build_vocab
label_desc: Use image node_id 1 for calling a global function with example usage: test_numpy_memmap_storage() without return types