class_docstr: Base class for models
class_docstr_tok: ["Base","class","for","models"]
code: def _compute_data_loss(self):
      if self.hparams.loss == "cross_entropy_loss":
          data_loss = tf.reduce_mean(
              input_tensor=tf.nn.sigmoid_cross_entropy_with_logits(
                  logits=tf.reshape(self.logit, [-1]),
                  labels=tf.reshape(self.iterator.labels, [-1]),
              )
          )
      elif self.hparams.loss == "square_loss":
          data_loss = tf.sqrt(
              tf.reduce_mean(
                  input_tensor=tf.math.squared_difference(
                      tf.reshape(self.pred, [-1]),
                      tf.reshape(self.iterator.labels, [-1]),
                  )
              )
          )
      elif self.hparams.loss == "log_loss":
          data_loss = tf.reduce_mean(
              input_tensor=tf.compat.v1.losses.log_loss(
                  predictions=tf.reshape(self.pred, [-1]),
                  labels=tf.reshape(self.iterator.labels, [-1]),
              )
          )
      elif self.hparams.loss == "softmax":
          group = self.train_num_ngs + 1
          logits = tf.reshape(self.logit, (-1, group))
          if self.hparams.model_type == "NextItNet":
              labels = (
                  tf.transpose(
                      a=tf.reshape(
                          self.iterator.labels,
                          (-1, group, self.hparams.max_seq_length),
                      ),
                      perm=[0, 2, 1],
                  ),
              )
              labels = tf.reshape(labels, (-1, group))
          else:
              labels = tf.reshape(self.iterator.labels, (-1, group))
          softmax_pred = tf.nn.softmax(logits, axis=-1)
          boolean_mask = tf.equal(labels, tf.ones_like(labels))
          mask_paddings = tf.ones_like(softmax_pred)
          pos_softmax = tf.compat.v1.where(
              boolean_mask, softmax_pred, mask_paddings
          )
          data_loss = -group * tf.reduce_mean(
              input_tensor=tf.math.log(pos_softmax)
          )
      else:
          raise ValueError(
              "this loss not defined {0}".format(self.hparams.loss)
          )
      return data_loss
  
imports: from os.path import join
  import abc
  import time
  import os
  import numpy
  import tensorflow
  from recommenders.models.deeprec.deeprec_utils import cal_metric
label_desc: Use image node_id 10 for calling the BaseModel obj's underlying member method code with example usage: obj._compute_data_loss() and returns: data_loss