import torch


def invsoftplus(x):
    """Inverse of torch.nn.functional.softplus"""
    bound = 20.0
    xa = torch.clamp(x, None, bound)
    res = torch.log(torch.exp(xa)-1.0)*(xa < bound) + xa*(xa >= bound)
    return res