TensorPlay
Reference guides
latest (dev)
Copy
View Markdown

Latest development documentation · Updated 2026-10-08

tensorplay.distributions

Classes

tensorplay.distributions.AbsTransform

Transform via the mapping y=∣x∣y = |x|.

tensorplay.distributions.AffineTransform

Transform via the pointwise affine mapping y=loc+scale×xy = \text{loc} + \text{scale} \times x.

tensorplay.distributions.Bernoulli

Creates a Bernoulli distribution parameterized by probs or logits (but not both).

tensorplay.distributions.Beta

Beta distribution parameterized by concentration1 and concentration0.

tensorplay.distributions.Binomial

Creates a Binomial distribution parameterized by total_count and either probs or logits (but not both).

tensorplay.distributions.CatTransform

Transform functor that applies a sequence of transforms tseq component-wise to each submatrix at dim, of length lengths[dim], in a way compatible with tensorplay.cat().

tensorplay.distributions.Categorical

Creates a categorical distribution parameterized by either probs or logits (but not both).

tensorplay.distributions.Cauchy

Samples from a Cauchy (Lorentz) distribution.

tensorplay.distributions.Chi2

Creates a Chi-squared distribution parameterized by shape parameter df.

tensorplay.distributions.ComposeTransform

Composes multiple transforms in a chain.

tensorplay.distributions.ContinuousBernoulli

Creates a continuous Bernoulli distribution parameterized by probs or logits (but not both).

tensorplay.distributions.CorrCholeskyTransform

Transforms an unconstrained real vector xx with length D∗(D−1)/2D*(D-1)/2 into the Cholesky factor of a D-dimension correlation matrix.

tensorplay.distributions.CumulativeDistributionTransform

Transform via the cumulative distribution function of a probability distribution.

tensorplay.distributions.Dirichlet

Creates a Dirichlet distribution parameterized by concentration concentration.

tensorplay.distributions.Distribution

Distribution is the abstract base class for probability distributions.

tensorplay.distributions.ExpTransform

Transform via the mapping y=exp⁡(x)y = \exp(x).

tensorplay.distributions.Exponential

Creates an Exponential distribution parameterized by rate.

tensorplay.distributions.ExponentialFamily

ExponentialFamily is the abstract base class for probability distributions belonging to an exponential family, whose probability mass/density function is defined below

tensorplay.distributions.FisherSnedecor

Creates a Fisher-Snedecor distribution parameterized by df1 and df2.

tensorplay.distributions.Gamma

Creates a Gamma distribution parameterized by shape concentration and rate.

tensorplay.distributions.GeneralizedPareto

Creates a Generalized Pareto distribution parameterized by loc, scale, and concentration.

tensorplay.distributions.Geometric

Creates a Geometric distribution parameterized by probs, where probs is the probability of success of Bernoulli trials.

tensorplay.distributions.Gumbel

Samples from a Gumbel Distribution.

tensorplay.distributions.HalfCauchy

Creates a half-Cauchy distribution parameterized by scale where.

tensorplay.distributions.HalfNormal

Creates a half-normal distribution parameterized by scale where.

tensorplay.distributions.Independent

Reinterprets some of the batch dims of a distribution as event dims.

tensorplay.distributions.IndependentTransform

Wrapper around another transform to treat reinterpreted_batch_ndims-many extra of the right most dimensions as dependent.

tensorplay.distributions.InverseGamma

Creates an inverse gamma distribution parameterized by concentration and rate where.

tensorplay.distributions.Kumaraswamy

Samples from a Kumaraswamy distribution.

tensorplay.distributions.LKJCholesky

LKJ distribution for lower Cholesky factor of correlation matrices. The distribution is controlled by concentration parameter η\eta to make the probability of the correlation matrix MM generated from a Cholesky factor proportional to det⁡(M)η−1\det(M)^{\eta - 1}. Because of that, when concentration == 1, we have a uniform distribution over Cholesky factors of correlation matrices::.

tensorplay.distributions.Laplace

Creates a Laplace distribution parameterized by loc and scale.

tensorplay.distributions.LogNormal

Creates a log-normal distribution parameterized by loc and scale where.

tensorplay.distributions.LogisticNormal

Creates a logistic-normal distribution parameterized by loc and scale that define the base Normal distribution transformed with the StickBreakingTransform such that.

tensorplay.distributions.LowRankMultivariateNormal

Creates a multivariate normal distribution with covariance matrix having a low-rank form parameterized by cov_factor and cov_diag.

tensorplay.distributions.LowerCholeskyTransform

Transform from unconstrained matrices to lower-triangular matrices with nonnegative diagonal entries.

tensorplay.distributions.MixtureSameFamily

The MixtureSameFamily distribution implements a (batch of) mixture distribution where all components are from different parameterizations of the same distribution type.

tensorplay.distributions.Multinomial

Creates a Multinomial distribution parameterized by total_count and either probs or logits (but not both).

tensorplay.distributions.MultivariateNormal

Creates a multivariate normal (also called Gaussian) distribution parameterized by a mean vector and a covariance matrix.

tensorplay.distributions.NegativeBinomial

Creates a Negative Binomial distribution, i.e. distribution of the number of successful independent and identical Bernoulli trials before total_count failures are achieved.

tensorplay.distributions.Normal

Creates a normal (also called Gaussian) distribution parameterized by loc and scale.

tensorplay.distributions.OneHotCategorical

Creates a one-hot categorical distribution parameterized by probs or logits.

tensorplay.distributions.OneHotCategoricalStraightThrough

Creates a reparameterizable OneHotCategorical distribution based on the straight- through gradient estimator from [1].

tensorplay.distributions.Pareto

Samples from a Pareto Type 1 distribution.

tensorplay.distributions.Poisson

Creates a Poisson distribution parameterized by rate, the rate parameter.

tensorplay.distributions.PositiveDefiniteTransform

Transform from unconstrained matrices to positive-definite matrices.

tensorplay.distributions.PowerTransform

Transform via the mapping y=xexponenty = x^{\text{exponent}}.

tensorplay.distributions.RelaxedBernoulli

Creates a RelaxedBernoulli distribution, parameterized by temperature, and either probs or logits (but not both).

tensorplay.distributions.RelaxedOneHotCategorical

Creates a RelaxedOneHotCategorical distribution parameterized by temperature, and either probs or logits.

tensorplay.distributions.ReshapeTransform

Unit Jacobian transform to reshape the rightmost part of a tensor.

tensorplay.distributions.SigmoidTransform

Transform via the mapping y=11+exp⁡(−x)y = \frac{1}{1 + \exp(-x)} and x=logit(y)x = \text{logit}(y).

tensorplay.distributions.SoftmaxTransform

Transform from unconstrained space to the simplex via y=exp⁡(x)y = \exp(x) then normalizing.

tensorplay.distributions.SoftplusTransform

Transform via the mapping Softplus(x)=log⁡(1+exp⁡(x))\text{Softplus}(x) = \log(1 + \exp(x)).

tensorplay.distributions.StackTransform

Transform functor that applies a sequence of transforms tseq component-wise to each submatrix at dim in a way compatible with tensorplay.stack().

tensorplay.distributions.StickBreakingTransform

Transform from unconstrained space to the simplex of one additional dimension via a stick-breaking process.

tensorplay.distributions.StudentT

Creates a Student's t-distribution parameterized by degree of freedom df, mean loc and scale scale.

tensorplay.distributions.TanhTransform

Transform via the mapping y=tanh⁡(x)y = \tanh(x).

tensorplay.distributions.Transform

Abstract class for invertible transformations with computable log det jacobians.

tensorplay.distributions.TransformedDistribution

Extension of the Distribution class, which applies a sequence of Transforms to a base distribution. Let f be the composition of transforms applied::.

tensorplay.distributions.Uniform

Generates uniformly distributed random samples from the half-open interval [low, high).

tensorplay.distributions.VonMises

A circular von Mises distribution.

tensorplay.distributions.Weibull

Samples from a two-parameter Weibull distribution.

tensorplay.distributions.Wishart

Creates a Wishart distribution parameterized by a symmetric positive definite matrix Σ\Sigma, or its Cholesky decomposition Σ=LL⊤\mathbf{\Sigma} = \mathbf{L}\mathbf{L}^\top

Functions

tensorplay.distributions.kl_divergence

Compute Kullback-Leibler divergence KL(p∥q)KL(p \| q) between two distributions.

tensorplay.distributions.register_kl

Decorator to register a pairwise function with kl_divergence(). Usage::.

On this page

Ask DeepWiki