code: def _FastDotProductRecommender(
      batch_size, dim_embed, total_users, total_items
  ):
      rec = PMF(
          batch_size=batch_size,
          dim_user_embed=dim_embed,
          dim_item_embed=dim_embed,
          total_users=total_users,
          total_items=total_items,
          init_model_dir=None,
          save_model_dir=None,
          train=False,
          serve=True,
      )
      s = rec.servegraph
  
      @s.inputgraph.extend(
          outs=["user_lf_cache", "item_lf_cache", "item_bias_cache"]
      )
      def _add_input(subgraph):
          subgraph["user_lf_cache"] = tf.placeholder(
              tf.float32,
              shape=[total_users, dim_embed],
              name="user_lf_cache",
          )
          subgraph["item_lf_cache"] = tf.placeholder(
              tf.float32,
              shape=[total_items, dim_embed],
              name="item_lf_cache",
          )
          subgraph["item_bias_cache"] = tf.placeholder(
              tf.float32, shape=[total_items, 1], name="item_bias_cache"
          )
  
          subgraph.register_global_input_mapping(
              {
                  "user_lf_cache": subgraph["user_lf_cache"],
                  "item_lf_cache": subgraph["item_lf_cache"],
                  "item_bias_cache": subgraph["item_bias_cache"],
              },
              "cache",
          )
  
      @s.usergraph.extend(ins=["user_lf_cache"])
      def _add_usergraph(subgraph):
          user_embedding, _ = LatentFactor(
              id_=None,
              shape=[total_users, dim_embed],
              subgraph=subgraph,
              scope="user",
          )
          subgraph.register_global_operation(
              tf.assign(user_embedding, subgraph["user_lf_cache"]),
              "cache",
          )
  
      @s.itemgraph.extend(ins=["item_lf_cache", "item_bias_cache"])
      def _add_itemgraph(subgraph):
          item_embedding, _ = LatentFactor(
              id_=None,
              shape=[total_items, dim_embed],
              subgraph=subgraph,
              scope="item",
          )
          item_bias_embedding, _ = LatentFactor(
              id_=None,
              shape=[total_items, 1],
              subgraph=subgraph,
              scope="item_bias",
          )
          subgraph.register_global_operation(
              tf.assign(item_embedding, subgraph["item_lf_cache"]),
              "cache",
          )
          subgraph.register_global_operation(
              tf.assign(
                  item_bias_embedding, subgraph["item_bias_cache"]
              ),
              "cache",
          )
  
      @s.connector.extend
      def _add_connect(graph):
          graph.usergraph["user_lf_cache"] = graph.inputgraph[
              "user_lf_cache"
          ]
          graph.itemgraph["item_lf_cache"] = graph.inputgraph[
              "item_lf_cache"
          ]
          graph.itemgraph["item_bias_cache"] = graph.inputgraph[
              "item_bias_cache"
          ]
  
      return rec
  
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 1 for calling a global function with example usage: _FastDotProductRecommender(batch_size, dim_embed, total_users, total_items) and returns: rec