import torch


def decode_μ_law(waveform: torch.Tensor, μ: int = 255) -> torch.Tensor:
    """
    Applies the element-wise inverse μ-law encoding to the tensor.

    Args:
        waveform: input tensor
        μ: size of the encoding (number of possible classes)

    Returns:
        the decoded tensor
    """
    assert μ & 1
    μ = μ - 1
    hμ = μ // 2
    out = (waveform.type(torch.float32) - hμ) / hμ
    out = torch.sign(out) / μ * (torch.pow(μ, torch.abs(out)) - 1)
    return out