It seems this can be implemented with simple lines:
def weighted_smooth_l1_loss(input, target, weights):
    # type: (Tensor, Tensor, Tensor) -> Tensor
    t = torch.abs(input - target)
    return weights * torch.where(t < 1, 0.5 * t ** 2, t - 0.5)

Then apply reduction such as torch.mean subsequently.