code: def _build_training_graph(self):
      with tf.variable_scope(self._scope, reuse=self._reuse):
          tmp_user = tf.tile(
              tf.expand_dims(self._user, 1), [1, self._neg_num, 1]
          )
          dot_user_pos = tf.tile(
              tf.reduce_sum(
                  tf.multiply(self._user, self._p_item),
                  reduction_indices=1,
                  keep_dims=True,
                  name="dot_user_pos",
              ),
              [1, self._neg_num],
          )
          dot_user_neg = tf.reduce_sum(
              tf.multiply(tmp_user, self._n_item),
              reduction_indices=2,
              name="dot_user_neg",
          )
  
          pos_score = dot_user_pos + tf.tile(
              self._p_item_bias, [1, self._neg_num]
          )
          neg_score = dot_user_neg + tf.reduce_sum(
              self._n_item_bias, reduction_indices=2
          )
          diff = pos_score - neg_score
          weights = tf.count_nonzero(tf.less(diff, 0.0), axis=1)
          weights = tf.log(
              tf.floor(
                  self._max_item * tf.to_float(weights) / self._neg_num
              )
              + 1.0
          )
          self._loss = -tf.reduce_sum(
              tf.log(
                  tf.sigmoid(
                      tf.maximum(
                          weights * tf.reduce_min(diff, axis=1), -30.0
                      )
                  )
              )
          )
  
imports: import tensorflow
  from openrec.tf1.legacy.modules.interactions import Interaction
label_desc: Use image node_id 2 for calling the NsLog obj's underlying member method code with example usage: obj._build_training_graph() without return types