docstr: Add one document to the indexed dataset.
  It will pad the tokens to be the multiple of chunk_size.
  If it is retrieval dataset, it will pad extra chunk_size tokens at the end of the document.
docstr_tok: ["Add","one","document","to","the","indexed","dataset",".","It","will","pad","the","tokens","to","be","the","multiple","of","chunk_size",".","If","it","is","retrieval","dataset",",","it","will","pad","extra","chunk_size","tokens","at","the","end","of","the","document","."]
code: def add_item(self, tensor):
      """
      Add one document to the indexed dataset.
      It will pad the tokens to be the multiple of chunk_size.
      If it is retrieval dataset, it will pad extra chunk_size tokens at the end of the document.
      """
      np_array = np.array(tensor.numpy(), dtype=self._dtype)
      padded_size = self.chunk_size - (len(np_array) % self.chunk_size)
      data_size = np_array.size + padded_size
      if self.retrieval_db:
          # for retrieval database, added one more chunk in the end as padding
          padded_size += self.chunk_size
      np_array = np.pad(
          np_array,
          (0, padded_size),
          "constant",
          constant_values=self.pad_id,
      )
      self._data_file.write(np_array.tobytes(order="C"))
      self._sizes.append(data_size)
  
imports: import os
  import shutil
  import struct
  from functools import lru_cache
  from itertools import accumulate
  from typing import List
  import numpy
  import torch
  from nemo.utils import logging
label_desc: Use image node_id 2 for calling the MMapRetrievalIndexedDatasetBuilder obj's underlying member method code with example usage: obj.add_item(tensor) without return types