(self, logits, labels)
return loss
Adds ops for loss to the computational graph.

        Args:
          logits: A tensor of shape (batch_size, n_classes)
          labels: A tensor - placeholder probably,  of shape (batch_size, n_class)
        Returns:
          loss: A 0-d tensor (scalar) output
Adds ops for loss to the computational graph.
Adds ops for loss to the computational graph .
def add_loss_op(self, logits, labels):
        """Adds ops for loss to the computational graph.

        Args:
          logits: A tensor of shape (batch_size, n_classes)
          labels: A tensor - placeholder probably,  of shape (batch_size, n_class)
        Returns:
          loss: A 0-d tensor (scalar) output
        """
        labels_float = tf.to_float(labels)
        loss = tf.nn.softmax_cross_entropy_with_logits(logits=logits, labels=labels_float)
        loss = tf.reduce_mean(loss)
        reg_loss = tf.add_n([tf.nn.l2_loss(v) for v in tf.trainable_variables() if v != self.embedding])
        loss = loss + self.config.reg * reg_loss
        return loss
def add_loss_op ( self , logits , labels ) : labels_float = tf . to_float ( labels ) loss = tf . nn . softmax_cross_entropy_with_logits ( logits = logits , labels = labels_float ) loss = tf . reduce_mean ( loss ) reg_loss = tf . add_n ( [ tf . nn . l2_loss ( v ) for v in tf . trainable_variables ( ) if v != self . embedding ] ) loss = loss + self . config . reg * reg_loss return loss