Exemplo n.º 1
0
 def compute_loss(self, outputs, labels, training=True):
     return cross_entropy_loss(
         outputs,
         labels["classes_id"],
         weight=labels.get("weight"),
         label_smoothing=self.params.get("label_smoothing", 0.0),
         training=training,
     )
Exemplo n.º 2
0
 def compute_loss(self, outputs, labels, training=True, params=None):
     if params is None:
         params = {}
     return cross_entropy_loss(outputs,
                               labels["classes_id"],
                               label_smoothing=params.get(
                                   "label_smoothing", 0.0),
                               training=training)
Exemplo n.º 3
0
 def compute_loss(self, outputs, labels, training=True, params=None):
     if params is None:
         params = {}
     return cross_entropy_loss(outputs,
                               labels["classes_id"],
                               label_smoothing=params.get(
                                   "label_smoothing", 0.0),
                               mode=tf.estimator.ModeKeys.TRAIN
                               if training else tf.estimator.ModeKeys.EVAL)
Exemplo n.º 4
0
 def _compute_loss(self, features, labels, outputs, params, mode):
     return cross_entropy_loss(outputs,
                               labels["classes_id"],
                               label_smoothing=params.get(
                                   "label_smoothing", 0.0),
                               mode=mode)
Exemplo n.º 5
0
 def _compute_loss(self, features, labels, outputs, params, mode):
   return cross_entropy_loss(
       outputs,
       labels["classes_id"],
       label_smoothing=params.get("label_smoothing", 0.0),
       mode=mode)