import torch


def entropy_log(values: torch.Tensor) -> torch.Tensor:
    """
    Calculate log of pytorch tensor used for entropy calculation.
    0 results in 0 as they add zero information to entropy.
    :param values: input values.
    :return: prepared log of values.
    """
    _log = torch.log(values)
    mask = torch.isinf(_log)
    return _log.masked_fill(mask, 0)