class_docstr: Create dataset cache from local file.
  
  If you want to create cache data from remote resource, use data_iterator_csv_dataset instead.
class_docstr_tok: ["Create","dataset","cache","from","local","file",".","If","you","want","to","create","cache","data","from","remote","resource",",","use","data_iterator_csv_dataset","instead","."]
code: def _save_cache(self, args):
      position = args[0]
      cache_csv = args[1]
      # conv dataset
      cache_data = [tuple(self._process_row(row)) for row in cache_csv]
  
      start_position = position + 1 - len(cache_data)
      end_position = position
      cache_filename = os.path.join(
          self._cache_dir,
          "{}_{:08d}_{:08d}{}".format(
              self._cache_file_name_prefix,
              start_position,
              end_position,
              self._cache_file_format,
          ),
      )
  
      logger.info("Creating cache file {}".format(cache_filename))
  
      data = collections.OrderedDict([(n, []) for n in self._variables])
      for _, cd in enumerate(cache_data):
          for i, n in enumerate(self._variables):
              if isinstance(cd[i], numpy.ndarray):
                  d = cd[i]
              else:
                  d = numpy.array(cd[i]).astype(numpy.float32)
              data[n].append(d)
  
      try:
          if self._cache_file_format == ".h5":
              h5 = h5py.File(cache_filename, "w")
              for k, v in data.items():
                  h5.create_dataset(k, data=v)
              h5.close()
          else:
              retry_count = 1
              is_create_cache_incomplete = True
              while is_create_cache_incomplete:
                  try:
                      with open(cache_filename, "wb") as f:
                          for v in data.values():
                              numpy.save(f, v)
                      is_create_cache_incomplete = False
                  except OSError:
                      retry_count += 1
                      if retry_count > 10:
                          raise
                      logger.info(
                          "Creating cache retry {}/10".format(
                              retry_count
                          )
                      )
      except:
          logger.critical(
              "An error occurred while creating cache file from dataset."
          )
          for k, v in data.items():
              size = v[0].shape
              for d in v:
                  if size != d.shape:
                      logger.critical(
                          'The sizes of data "{}" are not the same. ({} != {})'.format(
                              k, size, d.shape
                          )
                      )
          raise
  
      self.current_cache_position += 1
      if single_or_rankzero():
          if (
              self.current_cache_position
              % int(self.num_of_cache_file / 20 + 1)
              == 0
          ):
              progress(
                  "Create cache",
                  self.current_cache_position / self.num_of_cache_file,
              )
      return cache_filename, len(cache_data)
  
file_path: nnabla/python/src/nnabla/utils/create_cache.py
imports: import collections
  import csv
  import os
  import shutil
  from contextlib import closing
  from multiprocessing.pool import ThreadPool
  import h5py
  import numpy
  from nnabla.config import nnabla_config
  from nnabla.logger import logger
  from nnabla.utils.data_source_implements import CsvDataSource
  from nnabla.utils.data_source_loader import FileReader
  from nnabla.utils.progress import progress
  from nnabla.utils.communicator_util import single_or_rankzero
label_desc: Use image node_id 1 for calling the CreateCache obj's underlying member method code with example usage: obj._save_cache(args) and returns: cache_filename,  len