code: def _cache(self):
      # print(colored('..Caching', 'yellow'), end='')
      num_batch = math.ceil(float(self._total_users) / self._batch_size)
      for batch_id in range(num_batch):
          input_batch = np.arange(
              batch_id * self._batch_size,
              min((batch_id + 1) * self._batch_size, self._total_users),
          )
          self._user_lf_cache[input_batch] = self._extract_user_lf_func(
              self._model, input_batch
          )
      # print(colored('..user embedding', 'yellow'), end='')
  
      num_batch = math.ceil(float(self._total_items) / self._batch_size)
      for batch_id in range(num_batch):
          input_batch = np.arange(
              batch_id * self._batch_size,
              min((batch_id + 1) * self._batch_size, self._total_items),
          )
          self._item_lf_cache[input_batch] = self._extract_item_lf_func(
              self._model, input_batch
          )
  
      if self._extract_item_bias_func is not None:
          # print(colored('..item embedding', 'yellow'), end='')
          num_batch = math.ceil(
              float(self._total_items) / self._batch_size
          )
          for batch_id in range(num_batch):
              input_batch = np.arange(
                  batch_id * self._batch_size,
                  min(
                      (batch_id + 1) * self._batch_size,
                      self._total_items,
                  ),
              )
              self._item_bias_cache[
                  input_batch
              ] = self._extract_item_bias_func(
                  self._model, input_batch
              ).reshape(
                  (-1, 1)
              )
          # print(colored('..item bias', 'yellow'), end='\t')
      # else:
      # print(colored('..item embedding', 'yellow'), end='\t')
  
      batch_data = {
          "user_lf_cache": self._user_lf_cache,
          "item_lf_cache": self._item_lf_cache,
          "item_bias_cache": self._item_bias_cache,
      }
  
      self._fastmodel.serve(
          batch_data=batch_data,
          input_mapping_id="cache",
          operations_id="cache",
          losses_id=None,
          outputs_id=None,
      )
  
file_path: openrec/openrec/tf1/fast_dot_product_server.py
imports: import numpy
  import tensorflow
  from termcolor import colored
  from openrec.tf1.recommenders import PMF
  from openrec.tf1.modules.extractions import LatentFactor
  import math
label_desc: Use image node_id 2 for calling the FastDotProductServer obj's underlying member method code with example usage: obj._cache() without return types