def _reg_loss(self, regr, gt_regr, mask):
    ' L1 regression loss\n            Arguments:\n            regr (batch x max_objects x dim)\n            gt_regr (batch x max_objects x dim)\n            mask (batch x max_objects)\n        '
    num = mask.float().sum()
    mask = mask.unsqueeze(2).expand_as(gt_regr).float()
    isnotnan = (~ torch.isnan(gt_regr)).float()
    mask *= isnotnan
    regr = (regr * mask)
    gt_regr = (gt_regr * mask)
    loss = torch.abs((regr - gt_regr))
    loss = loss.transpose(2, 0).contiguous()
    loss = torch.sum(loss, dim=2)
    loss = torch.sum(loss, dim=1)
    loss = (loss / (num + 0.0001))
    return loss
L1 regression loss
Arguments:
regr (batch x max_objects x dim)
gt_regr (batch x max_objects x dim)
mask (batch x max_objects)
def _reg_loss(self, regr, gt_regr, mask):
    ' L1 regression loss\n            Arguments:\n            regr (batch x max_objects x dim)\n            gt_regr (batch x max_objects x dim)\n            mask (batch x max_objects)\n        '
    num = mask.float().sum()
    mask = mask.unsqueeze(2).expand_as(gt_regr).float()
    isnotnan = (~ torch.isnan(gt_regr)).float()
    mask *= isnotnan
    regr = (regr * mask)
    gt_regr = (gt_regr * mask)
    loss = torch.abs((regr - gt_regr))
    loss = loss.transpose(2, 0).contiguous()
    loss = torch.sum(loss, dim=2)
    loss = torch.sum(loss, dim=1)
    loss = (loss / (num + 0.0001))
    return loss