chemprop.nn.message_passing.multi#

Attributes#

Classes#

MulticomponentMessagePassing

A MulticomponentMessagePassing performs message-passing on each individual input in a

Module Contents#

chemprop.nn.message_passing.multi.logger#
class chemprop.nn.message_passing.multi.MulticomponentMessagePassing(blocks, n_components=None, shared=False)[source]#

Bases: torch.nn.Module, 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

Parameters:
  • blocks (Sequence[MessagePassing]) – the invidual message-passing blocks for each input

  • n_components (int, optional) – the number of components in each input

  • shared (bool, default=False) – whether one block will be shared among all components in an input. If not, a separate block will be learned for each component.

hparams#
n_components = None#
shared = False#
blocks#
__len__()[source]#
Return type:

int

property output_dim: int#
Return type:

int

forward(bmgs, V_ds=None)[source]#

Encode the multicomponent inputs

Parameters:
  • bmgs (Iterable[BatchMolGraph])

  • V_ds (Iterable[Tensor | None] | 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

Return type:

list[Tensor]