class_docstr: Sequential User Matrix Model
  
  :Citation:
  
      Lian, J., Batal, I., Liu, Z., Soni, A., Kang, E. Y., Wang, Y., & Xie, X.,
      "Multi-Interest-Aware User Modeling for Large-Scale Sequential Recommendations", arXiv preprint arXiv:2102.09211, 2021.
docstr: Generate  user memory states from behavior sequence
  
  Args:
      object: An initialied SUM cell.
  
  Returns:
      object: A flatten representation of user memory states, in the shape of (BatchSize, SlotsNum x HiddenSize)
docstr_tok: ["Generate","user","memory","states","from","behavior","sequence","Args",":","object",":","An","initialied","SUM","cell",".","Returns",":","object",":","A","flatten","representation","of","user","memory","states",",","in","the","shape","of","(","BatchSize",",","SlotsNum","x","HiddenSize",")"]
code: def _build_sum(self, cell):
      """Generate  user memory states from behavior sequence
  
      Args:
          object: An initialied SUM cell.
  
      Returns:
          object: A flatten representation of user memory states, in the shape of (BatchSize, SlotsNum x HiddenSize)
      """
      hparams = self.hparams
      with tf.compat.v1.variable_scope("sum"):
          self.mask = self.iterator.mask
          self.sequence_length = tf.reduce_sum(
              input_tensor=self.mask, axis=1
          )
  
          rum_outputs, final_state = dynamic_rnn(
              cell,
              inputs=self.history_embedding,
              dtype=tf.float32,
              sequence_length=self.sequence_length,
              scope="sum",
              initial_state=cell.zero_state(
                  tf.shape(input=self.history_embedding)[0], tf.float32
              ),
          )
  
          final_state = final_state[
              :, : hparams.slots * hparams.hidden_size
          ]
  
          self.heads = cell.heads
          self.alpha = cell._alpha
          self.beta = cell._beta
          tf.compat.v1.summary.histogram("SUM_outputs", rum_outputs)
  
      return final_state
  
file_path: recommenders/recommenders/models/deeprec/models/sequential/sum.py
imports: import tensorflow
  from tensorflow.compat.v1.nn import dynamic_rnn
  from recommenders.models.deeprec.models.sequential.sequential_base_model import SequentialBaseModel
  from recommenders.models.deeprec.models.sequential.sum_cells import SUMCell, SUMV2Cell
label_desc: Use image node_id 4 for calling the SUMModel obj's underlying member method code with example usage: obj._build_sum(cell) and returns: final_state