class_docstr: LSTUR model(Neural News Recommendation with Multi-Head Self-Attention)
  
  Mingxiao An, Fangzhao Wu, Chuhan Wu, Kun Zhang, Zheng Liu and Xing Xie:
  Neural News Recommendation with Long- and Short-term User Representations, ACL 2019
  
  Attributes:
      word2vec_embedding (numpy.ndarray): Pretrained word embedding matrix.
      hparam (object): Global hyper-parameters.
docstr: The main function to create user encoder of LSTUR.
  
  Args:
      titleencoder (object): the news encoder of LSTUR.
  
  Return:
      object: the user encoder of LSTUR.
docstr_tok: ["The","main","function","to","create","user","encoder","of","LSTUR",".","Args",":","titleencoder","(","object",")",":","the","news","encoder","of","LSTUR",".","Return",":","object",":","the","user","encoder","of","LSTUR","."]
code: def _build_userencoder(self, titleencoder, type="ini"):
      """The main function to create user encoder of LSTUR.
  
      Args:
          titleencoder (object): the news encoder of LSTUR.
  
      Return:
          object: the user encoder of LSTUR.
      """
      hparams = self.hparams
      his_input_title = keras.Input(
          shape=(hparams.his_size, hparams.title_size), dtype="int32"
      )
      user_indexes = keras.Input(shape=(1,), dtype="int32")
  
      user_embedding_layer = layers.Embedding(
          len(self.train_iterator.uid2index),
          hparams.gru_unit,
          trainable=True,
          embeddings_initializer="zeros",
      )
  
      long_u_emb = layers.Reshape((hparams.gru_unit,))(
          user_embedding_layer(user_indexes)
      )
      click_title_presents = layers.TimeDistributed(titleencoder)(
          his_input_title
      )
  
      if type == "ini":
          user_present = layers.GRU(
              hparams.gru_unit,
              kernel_initializer=keras.initializers.glorot_uniform(
                  seed=self.seed
              ),
              recurrent_initializer=keras.initializers.glorot_uniform(
                  seed=self.seed
              ),
              bias_initializer=keras.initializers.Zeros(),
          )(
              layers.Masking(mask_value=0.0)(click_title_presents),
              initial_state=[long_u_emb],
          )
      elif type == "con":
          short_uemb = layers.GRU(
              hparams.gru_unit,
              kernel_initializer=keras.initializers.glorot_uniform(
                  seed=self.seed
              ),
              recurrent_initializer=keras.initializers.glorot_uniform(
                  seed=self.seed
              ),
              bias_initializer=keras.initializers.Zeros(),
          )(layers.Masking(mask_value=0.0)(click_title_presents))
  
          user_present = layers.Concatenate()([short_uemb, long_u_emb])
          user_present = layers.Dense(
              hparams.gru_unit,
              bias_initializer=keras.initializers.Zeros(),
              kernel_initializer=keras.initializers.glorot_uniform(
                  seed=self.seed
              ),
          )(user_present)
  
      model = keras.Model(
          [his_input_title, user_indexes],
          user_present,
          name="user_encoder",
      )
      return model
  
file_path: recommenders/recommenders/models/newsrec/models/lstur.py
imports: import tensorflow.compat.v1.keras
  from tensorflow.compat.v1.keras import layers
  from recommenders.models.newsrec.models.base_model import BaseModel
  from recommenders.models.newsrec.models.layers import AttLayer2, ComputeMasking, OverwriteMasking
label_desc: Use image node_id 6 for calling the LSTURModel obj's underlying member method code with example usage: obj._build_userencoder(titleencoder, type) and returns: model