def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor=None):
    '\n        Args:\n            input: (B, #anchors, #codes) float tensor.\n                Ecoded predicted locations of objects.\n            target: (B, #anchors, #codes) float tensor.\n                Regression targets.\n            weights: (B, #anchors) float tensor if not None.\n\n        Returns:\n            loss: (B, #anchors) float tensor.\n                Weighted smooth l1 loss without reduction.\n        '
    target = torch.where(torch.isnan(target), input, target)
    diff = (input - target)
    if (self.code_weights is not None):
        diff = (diff * self.code_weights.view(1, 1, (- 1)))
    loss = self.smooth_l1_loss(diff, self.beta)
    if (weights is not None):
        assert ((weights.shape[0] == loss.shape[0]) and (weights.shape[1] == loss.shape[1]))
        loss = (loss * weights.unsqueeze((- 1)))
    return loss
Args:
    input: (B, #anchors, #codes) float tensor.
        Ecoded predicted locations of objects.
    target: (B, #anchors, #codes) float tensor.
        Regression targets.
    weights: (B, #anchors) float tensor if not None.

Returns:
    loss: (B, #anchors) float tensor.
        Weighted smooth l1 loss without reduction.
def forward(self, input: torch.Tensor, target: torch.Tensor, weights: torch.Tensor=None):
    '\n        Args:\n            input: (B, #anchors, #codes) float tensor.\n                Ecoded predicted locations of objects.\n            target: (B, #anchors, #codes) float tensor.\n                Regression targets.\n            weights: (B, #anchors) float tensor if not None.\n\n        Returns:\n            loss: (B, #anchors) float tensor.\n                Weighted smooth l1 loss without reduction.\n        '
    target = torch.where(torch.isnan(target), input, target)
    diff = (input - target)
    if (self.code_weights is not None):
        diff = (diff * self.code_weights.view(1, 1, (- 1)))
    loss = self.smooth_l1_loss(diff, self.beta)
    if (weights is not None):
        assert ((weights.shape[0] == loss.shape[0]) and (weights.shape[1] == loss.shape[1]))
        loss = (loss * weights.unsqueeze((- 1)))
    return loss