probly.utils.torch.torch_entropy

probly.utils.torch.torch_entropy(p: Tensor) Tensor[source]

Shannon entropy H(p) computed in torch along the last dim; 0*log(0) treated as 0.

Parameters:

p – Probabilities to compute entropy of.

Returns:

Entropy of probabilities p