hasktorch-0.2.0.0: Functional differentiable programming in Haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Torch.Distributions.Categorical

Synopsis

Documentation

data Categorical Source #

Creates a categorical distribution parameterized by either :attr:probs or | :attr:logits (but not both). | .. note:: | It is equivalent to the distribution that :func:`torch.multinomial` | samples from. | Samples are integers from :math:`{0, ldots, K-1}` where K is ``probs.size(-1)``. | If :attr:probs is 1D with length-K, each element is the relative | probability of sampling the class at that index. | If :attr:probs is 2D, it is treated as a batch of relative probability | vectors. | .. note:: :attr:probs must be non-negative, finite and have a non-zero sum, | and it will be normalized to sum to 1. | See also: `torch.multinomial` | Example:: | >>> m = Categorical.fromProbs $ D.asTensor [ 0.25, 0.25, 0.25, 0.25 ] | >>> Distribution.sample m -- equal probability of 0, 1, 2, 3 | tensor(3)

Constructors

Categorical 

Fields