(self, prediction_tensor, target_tensor, weights)
return square_diff.sum(2)
Compute loss function.

    Args:
      prediction_tensor: A float tensor of shape [batch_size, num_anchors,
        code_size] representing the (encoded) predicted locations of objects.
      target_tensor: A float tensor of shape [batch_size, num_anchors,
        code_size] representing the regression targets
      weights: a float tensor of shape [batch_size, num_anchors]

    Returns:
      loss: a float tensor of shape [batch_size, num_anchors] tensor
        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,
        code_size] representing the (encoded) predicted locations of objects.
      target_tensor: A float tensor of shape [batch_size, num_anchors,
        code_size] representing the regression targets
      weights: a float tensor of shape [batch_size, num_anchors]

    Returns:
      loss: a float tensor of shape [batch_size, num_anchors] tensor
        representing the value of the loss function.
    """
    diff = prediction_tensor - target_tensor
    if self._code_weights is not None:
      self._code_weights = self._code_weights.type_as(prediction_tensor)
      self._code_weights = self._code_weights.view(1, 1, -1)
      diff = self._code_weights * diff
    weighted_diff = diff * weights.unsqueeze(-1)
    square_diff = 0.5 * weighted_diff * weighted_diff
    return square_diff.sum(2)
def _compute_loss ( self , prediction_tensor , target_tensor , weights ) : diff = prediction_tensor - target_tensor if self . _code_weights is not None : self . _code_weights = self . _code_weights . type_as ( prediction_tensor ) self . _code_weights = self . _code_weights . view ( 1 , 1 , - 1 ) diff = self . _code_weights * diff weighted_diff = diff * weights . unsqueeze ( - 1 ) square_diff = 0.5 * weighted_diff * weighted_diff return square_diff . sum ( 2 )