chemprop.nn.message_passing.multi#
Attributes#
Classes#
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, shared=False)[source]#
Bases:
torch.nn.Module,chemprop.nn.hparams.HasHParamsA 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) – 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#
- blocks#
- property output_dim: int#
- Return type:
int
- forward(bmgs, V_ds)[source]#
Encode the multicomponent inputs
- Parameters:
bmgs (Iterable[BatchMolGraph])
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
- Return type:
list[Tensor]