\ :py:mod:`clipppy.utils.distributions.extra_dimensions` ======================================================== .. py:module:: clipppy.utils.distributions.extra_dimensions Module Contents --------------- .. py:class:: ExtraBatched(base_dist: clipppy.utils.distributions.wrapper._Distribution, extra_shape: clipppy.utils.distributions.wrapper._size, validate_args=None) Base class for a distribution that delegates to another one. .. py:class:: ExtraDimensions(base_dist: clipppy.utils.distributions.wrapper._Distribution, extra_shape: clipppy.utils.distributions.wrapper._size, batch_shape: clipppy.utils.distributions.wrapper._size = None, event_shape: clipppy.utils.distributions.wrapper._size = None, validate_args=None) Base class for a distribution that delegates to another one. .. py:method:: entropy(self) Returns entropy of distribution, batched over batch_shape. Returns: Tensor of shape batch_shape. .. py:method:: expand(self, batch_shape, _instance=None) Returns a new distribution instance (or populates an existing instance provided by a derived class) with batch dimensions expanded to `batch_shape`. This method calls :class:`~torch.Tensor.expand` on the distribution's parameters. As such, this does not allocate new memory for the expanded distribution instance. Additionally, this does not repeat any args checking or parameter broadcasting in `__init__.py`, when an instance is first created. Args: batch_shape (torch.Size): the desired expanded size. _instance: new instance provided by subclasses that need to override `.expand`. Returns: New distribution instance with batch dimensions expanded to `batch_size`. .. py:method:: roll_to_right(self, value: torch.Tensor) .. py:method:: rsample(self, sample_shape: clipppy.utils.distributions.wrapper._size = torch.Size()) Generates a sample_shape shaped reparameterized sample or sample_shape shaped batch of reparameterized samples if the distribution parameters are batched. .. py:method:: sample_dim(self) :property: .. py:class:: ExtraIndependent(base_dist: clipppy.utils.distributions.wrapper._Distribution, extra_shape: clipppy.utils.distributions.wrapper._size, validate_args=None) Add more event dimensions without consuming existing batch dimensions. Useful in order to treat multiple samples as a dimension in an event and sum them in the probability and to allow proper plating. .. py:method:: log_prob(self, value) Returns the log of the probability density/mass function evaluated at `value`. Args: value (Tensor):