![]() ![]() ![]() ![]() Note that sample_shape is not an instance attribute because, conceptually, it is not associated with a distribution. sample, which takes sample_shape as an argument and generates samples from the distribution. This table is adapted from this blog post you might find the visualization in that post helpful.Įvery Distribution class has instance attributes batch_shape and event_shape.įurthermore, each class also has a method. Table 1: Examples of various combinations of shapes. \log\left[ \frac(\boldsymbol\mu_2, \boldsymbol\Sigma_2)$ The average ELBO over a batch of $b$ observations, $x_i$ for $i=1,\ldots,b$, is We take the Monte Carlo estimation of the evidence lower bound (ELBO) in the variational autoencoder (VAE) as an example to illustrate their differences. The definitions above might be difficult to understand. Event shape describes the shape of a single draw (event space) from the distribution it may be dependent across dimensions.įigure 1: Three groups of shapes.This enables the common use case in machine learning of a batch of examples, each modeled by its own distribution. Namely, we may have a set of (different) parameterizations to the same distribution. Batch shape describes independent, not identically distributed draws.Sample shape describes independent, identically distributed draws from the distribution.The three types of shapes are defined as follows and illustrated in Figure 1. On top of that, we try to answer a few questions related to the shapes in torch.distributions.Īll code examples are compatible with PyTorch v1.3.0. In this blog post, we describe the different types of shapes and illustrate the differences among them by code examples. Regular shapes have sides and angles of equal values, whereas irregular shapes have sides and angles of. The same definition of shapes is also used in other packages, including GluonTS, Pyro, etc. Shapes can come in both regular and irregular forms. There are three types of “shapes”, sample shape, batch shape, and event shape, that are crucial to understanding the torch.distributions package. It generally follows the design of the TensorFlow distributions package (Dillon et al. The torch.distributions package implements various probability distributions, as well as methods for sampling and computing statistics. Understanding Shapes in PyTorch Distributions Package ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |