def value_inv_transform(x: torch.Tensor, eps: float = 1e-2) -> torch.Tensor:
    """
    **Overview**:
        The inverse form of value transform. Given the input tensor ``x`` , this function will return the unnormalized tensor.
    """
    # The formula of the unnormalization is: $$h^{-1}(x) = sign(x)({(\frac{\sqrt{1+4\epsilon(|x|+1+\epsilon)}-1}{2\epsilon})}^2-1)$$
    return torch.sign(x) * (((torch.sqrt(1 + 4 * eps * (torch.abs(x) + 1 + eps)) - 1) / (2 * eps)) ** 2 - 1)

    **Overview**:
        The inverse form of value transform. Given the input tensor ``x`` , this function will return the unnormalized tensor.
    
chapter4_reward/value_rescale.py