entropy

probly.utils.entropy = <flextype.singledispatch.Flexdispatch object>

Compute the Shannon entropy of probability vectors along their last axis.

Parameters:

p – Probabilities of shape (..., num_classes) as a torch tensor or a jax array.

Returns:

Entropies of shape (...) in nats, with 0 * log(0) counted as zero.

Raises:

NotImplementedError – If no implementation is registered for the type of p.