(self, prediction_tensor, target_tensor, weights)
return per_row_cross_ent.view(weights.shape) * weights
Compute loss function.

    Args:
      prediction_tensor: A float tensor of shape [batch_size, num_anchors,
        num_classes] representing the predicted logits for each class
      target_tensor: A float tensor of shape [batch_size, num_anchors,
        num_classes] representing one-hot encoded classification targets
      weights: a float tensor of shape [batch_size, num_anchors]

    Returns:
      loss: a float tensor of shape [batch_size, num_anchors]
        representing the value of the loss function.
Compute loss function.
Compute loss function .
def _compute_loss(self, prediction_tensor, target_tensor, weights):
    """Compute loss function.

    Args:
      prediction_tensor: A float tensor of shape [batch_size, num_anchors,
        num_classes] representing the predicted logits for each class
      target_tensor: A float tensor of shape [batch_size, num_anchors,
        num_classes] representing one-hot encoded classification targets
      weights: a float tensor of shape [batch_size, num_anchors]

    Returns:
      loss: a float tensor of shape [batch_size, num_anchors]
        representing the value of the loss function.
    """
    num_classes = prediction_tensor.shape[-1]
    prediction_tensor = torch.div(
        prediction_tensor, self._logit_scale)
    per_row_cross_ent = (_softmax_cross_entropy_with_logits(
        labels=target_tensor.view(-1, num_classes),
        logits=prediction_tensor.view(-1, num_classes)))
    return per_row_cross_ent.view(weights.shape) * weights
def _compute_loss ( self , prediction_tensor , target_tensor , weights ) : num_classes = prediction_tensor . shape [ - 1 ] prediction_tensor = torch . div ( prediction_tensor , self . _logit_scale ) per_row_cross_ent = ( _softmax_cross_entropy_with_logits ( labels = target_tensor . view ( - 1 , num_classes ) , logits = prediction_tensor . view ( - 1 , num_classes ) ) ) return per_row_cross_ent . view ( weights . shape ) * weights