import torch


def cRM_tanh_recover(O, K=10, C=0.1):
    """CRM tanh recover.

    Args:
        O (torch.Tensor): predicted compressed crm.
        K (torch.Tensor): parameter to control the compression.
        C (torch.Tensor): parameter to control the compression.

    Returns:
        M (torch.Tensor): uncompressed crm.

    """

    numerator = K - O
    denominator = K + O
    M = -((1.0 / C) * torch.log((numerator / denominator)))

    return M