neural_lam.models.latent.constant_encoder
=========================================

.. py:module:: neural_lam.models.latent.constant_encoder

.. autoapi-nested-parse::

   Constant (input-independent) latent encoder.



Classes
-------

.. autoapisummary::

   neural_lam.models.latent.constant_encoder.ConstantLatentEncoder


Module Contents
---------------

.. py:class:: ConstantLatentEncoder(latent_dim: int, num_mesh_nodes: int, output_dist: str = 'isotropic')

   Bases: :py:obj:`neural_lam.models.latent.base_encoder.BaseLatentEncoder`


   Latent encoder that returns a constant (input-independent) distribution.

   ``compute_dist_params`` returns a tensor of zeros, so the resulting
   Normal is ``Normal(mean=0, std=1)`` for ``output_dist="isotropic"`` and
   ``Normal(mean=0, std=softplus(0)+eps)`` for ``output_dist="diagonal"``.

   Store the number of mesh nodes to produce parameters for.

   :param latent_dim: Dimensionality of the latent variable at each mesh node.
   :type latent_dim: int
   :param num_mesh_nodes: Number of mesh nodes the latent variable is defined on.
   :type num_mesh_nodes: int
   :param output_dist: Type of output distribution: ``"isotropic"`` or ``"diagonal"``.
   :type output_dist: str


   .. py:method:: compute_dist_params(grid_rep: torch.Tensor, **kwargs: Any) -> torch.Tensor

      Compute raw distribution parameters from the grid representation.

      For this constant encoder the parameters are all zeros, independent
      of the values in ``grid_rep``.

      :param grid_rep: Shape ``(B, num_grid_nodes, d_h)``. Grid input representation,
                       used only to determine batch size and device.
      :type grid_rep: torch.Tensor
      :param \*\*kwargs: Ignored; accepted for compatibility with the base class
                         interface.

      :returns: Shape ``(B, num_mesh_nodes, output_dim)``. Raw parameters of
                the latent distribution, all zeros.
      :rtype: torch.Tensor



   .. py:attribute:: num_mesh_nodes


