def _smooth_l1_loss(x, t, in_weight, sigma):
    sigma2 = (sigma ** 2)
    diff = (in_weight * (x - t))
    abs_diff = diff.abs()
    flag = (abs_diff.data < (1.0 / sigma2)).float()
    y = (((flag * (sigma2 / 2.0)) * (diff ** 2)) + ((1 - flag) * (abs_diff - (0.5 / sigma2))))
    return y.sum()
def _smooth_l1_loss(x, t, in_weight, sigma):
    sigma2 = (sigma ** 2)
    diff = (in_weight * (x - t))
    abs_diff = diff.abs()
    flag = (abs_diff.data < (1.0 / sigma2)).float()
    y = (((flag * (sigma2 / 2.0)) * (diff ** 2)) + ((1 - flag) * (abs_diff - (0.5 / sigma2))))
    return y.sum()