class_docstr: The Two Tower model used for recommendation retrieval.
  
  # Arguments
  user_col_info: user column information.
  item_col_info: item column information.
  hidden_layers: Units of hidden layers for each tower.
                 Tuple of positive int. Default is [1024, 512, 128].
class_docstr_tok: ["The","Two","Tower","model","used","for","recommendation","retrieval",".","#","Arguments","user_col_info",":","user","column","information",".","item_col_info",":","item","column","information",".","hidden_layers",":","Units","of","hidden","layers","for","each","tower",".","Tuple","of","positive","int",".","Default","is","[","1024",",","512",",","128","]","."]
code: def build_model(self):
      hidden_layers = self.hidden_layers
  
      # one tower
      def build_1tower(col_info):
          indicator_input_layers = []
          indicator_layers = []
          for i in range(len(col_info.indicator_cols)):
              indicator_input_layers.append(
                  Input(
                      shape=(),
                      name=col_info.name + col_info.indicator_cols[i],
                      dtype="int32",
                  )
              )
              indicator_layers.append(
                  tf.keras.backend.one_hot(
                      indicator_input_layers[i],
                      col_info.indicator_dims[i] + 1,
                  )
              )
  
          embed_input_layers = []
          embed_layers = []
          for i in range(len(col_info.embed_in_dims)):
              embed_input_layers.append(
                  Input(
                      shape=(),
                      name=col_info.name + col_info.embed_cols[i],
                      dtype="int32",
                  )
              )
              iembed = Embedding(
                  col_info.embed_in_dims[i] + 1,
                  output_dim=col_info.embed_out_dims[i],
              )(embed_input_layers[i])
              flat_embed = Flatten()(iembed)
              embed_layers.append(flat_embed)
  
          numerical_input_layers = []
          for i in range(len(col_info.numerical_cols)):
              numerical_input_layers.append(
                  Input(
                      shape=(col_info.numerical_dims[i]),
                      name=col_info.name + col_info.numerical_cols[i],
                  )
              )
  
          cocated = (
              indicator_layers + embed_layers + numerical_input_layers
          )
          concated = (
              cocated[0]
              if len(cocated) == 1
              else concatenate(cocated, axis=1)
          )
  
          linear = Dense(hidden_layers[0], activation="relu")(concated)
          for ilayer in range(1, len(hidden_layers)):
              linear_mid = Dense(
                  hidden_layers[ilayer], activation="relu"
              )(linear)
              linear = linear_mid
          last_linear = linear
  
          nomorlized = Lambda(
              lambda x: tf.nn.l2_normalize(x, axis=1),
              name=col_info.name + "_embed_output",
          )
          out = nomorlized(last_linear)
          input = (
              indicator_input_layers
              + embed_input_layers
              + numerical_input_layers
          )
  
          return input, out
  
      user_input, user_out = build_1tower(col_info=self.user_col_info)
      item_input, item_out = build_1tower(col_info=self.item_col_info)
  
      # dot operation to compute cosine similarity
      doted = tf.keras.layers.Dot(axes=1)
  
      out = doted([user_out, item_out])
  
      model = tf.keras.Model(user_input + item_input, out)
      return model
  
file_path: BigDL/python/friesian/example/two_tower/model.py
imports: from bigdl.dllib.keras.layers import *
  from tensorflow.keras.layers import Input, Embedding, Dense, Flatten, concatenate, Lambda
  import tensorflow
label_desc: Use image node_id 2 for calling the TwoTowerModel obj's underlying member method code with example usage: obj.build_model() and returns: model, input,  out