It’s also implemented for keras 56.
Here’s a pytorch version:
def soft_loss(predicted, target, beta=0.95):
    cross_entropy = F.nll_loss(predicted.log(), target, size_average=False)
    soft_reed = -predicted * torch.log(predicted + 1e-8)
    return beta * cross_entropy + (1 - beta) * torch.sum(soft_reed)

def hard_loss(predicted, target, beta=0.8):
    cross_entropy = F.nll_loss(predicted.log(), target, size_average=False)
    m_pred, _ = torch.max(predicted, dim=1, keepdim=True)
    hard_reed = - torch.log(m_pred + 1e-8)
    return beta * cross_entropy + (1 - beta) * torch.sum(hard_reed)

The loss is not yet averaged, so you have to divide by batch_size.