chemprop.nn.message_passing.multi
=================================

.. py:module:: chemprop.nn.message_passing.multi


Attributes
----------

.. autoapisummary::

   chemprop.nn.message_passing.multi.logger


Classes
-------

.. autoapisummary::

   chemprop.nn.message_passing.multi.MulticomponentMessagePassing


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

.. py:data:: logger

.. py:class:: MulticomponentMessagePassing(blocks, n_components, shared = False)

   Bases: :py:obj:`torch.nn.Module`, :py:obj:`chemprop.nn.hparams.HasHParams`


   A `MulticomponentMessagePassing` performs message-passing on each individual input in a
   multicomponent input then concatenates the representation of each input to construct a
   global representation

   :param blocks: the invidual message-passing blocks for each input
   :type blocks: Sequence[MessagePassing]
   :param n_components: the number of components in each input
   :type n_components: int
   :param shared: whether one block will be shared among all components in an input. If not, a separate
                  block will be learned for each component.
   :type shared: bool, default=False


   .. py:attribute:: hparams


   .. py:attribute:: n_components


   .. py:attribute:: shared
      :value: False



   .. py:attribute:: blocks


   .. py:method:: __len__()


   .. py:property:: output_dim
      :type: int



   .. py:method:: forward(bmgs, V_ds)

      Encode the multicomponent inputs

      :param bmgs:
      :type bmgs: Iterable[BatchMolGraph]
      :param V_ds:
      :type V_ds: Iterable[Tensor | None]

      :returns: a list of tensors of shape `V x d_i` containing the respective encodings of the `i` h
                component, where `d_i` is the output dimension of the `i`   h encoder
      :rtype: list[Tensor]



