(self, data, endpoints)
return total_loss
Creates all losses required to train the model.

    Args:
      data: InputEndpoints namedtuple.
      endpoints: Model namedtuple.

    Returns:
      Total loss.
Creates all losses required to train the model.
Creates all losses required to train the model .
def create_loss(self, data, endpoints):
    """Creates all losses required to train the model.

    Args:
      data: InputEndpoints namedtuple.
      endpoints: Model namedtuple.

    Returns:
      Total loss.
    """
    # NOTE: the return value of ModelLoss is not used directly for the
    # gradient computation because under the hood it calls slim.losses.AddLoss,
    # which registers the loss in an internal collection and later returns it
    # as part of GetTotalLoss. We need to use total loss because model may have
    # multiple losses including regularization losses.
    self.sequence_loss_fn(endpoints.chars_logit, data.labels)
    total_loss = slim.losses.get_total_loss()
    tf.summary.scalar('TotalLoss', total_loss)
    return total_loss
def create_loss ( self , data , endpoints ) : # NOTE: the return value of ModelLoss is not used directly for the # gradient computation because under the hood it calls slim.losses.AddLoss, # which registers the loss in an internal collection and later returns it # as part of GetTotalLoss. We need to use total loss because model may have # multiple losses including regularization losses. self . sequence_loss_fn ( endpoints . chars_logit , data . labels ) total_loss = slim . losses . get_total_loss ( ) tf . summary . scalar ( 'TotalLoss' , total_loss ) return total_loss