core.models.escaip.modules.output_block#

Classes#

OutputProjection

Base class for all neural network modules.

OutputLayer

Get the final prediction from the readouts (force or energy)

Module Contents#

class core.models.escaip.modules.output_block.OutputProjection(global_cfg: fairchem.core.models.escaip.configs.GlobalConfigs, gnn_cfg: fairchem.core.models.escaip.configs.GraphNeuralNetworksConfigs, reg_cfg: fairchem.core.models.escaip.configs.RegularizationConfigs)#

Bases: torch.nn.Module

Base class for all neural network modules.

Your models should also subclass this class.

Modules can also contain other Modules, allowing them to be nested in a tree structure. You can assign the submodules as regular attributes:

import torch.nn as nn
import torch.nn.functional as F

class Model(nn.Module):
    def __init__(self) -> None:
        super().__init__()
        self.conv1 = nn.Conv2d(1, 20, 5)
        self.conv2 = nn.Conv2d(20, 20, 5)

    def forward(self, x):
        x = F.relu(self.conv1(x))
        return F.relu(self.conv2(x))

Submodules assigned in this way will be registered, and will also have their parameters converted when you call to(), etc.

Note

As per the example above, an __init__() call to the parent class must be made before assignment on the child.

Variables:

training (bool) – Boolean represents whether this module is in training or evaluation mode.

use_edge_readout#
use_global_readout#
node_projection#
output_norm_node#
forward(data, global_readouts, node_readouts, edge_readouts)#
class core.models.escaip.modules.output_block.OutputLayer(global_cfg: fairchem.core.models.escaip.configs.GlobalConfigs, gnn_cfg: fairchem.core.models.escaip.configs.GraphNeuralNetworksConfigs, reg_cfg: fairchem.core.models.escaip.configs.RegularizationConfigs, output_type: Literal['Vector', 'Scalar'])#

Bases: torch.nn.Module

Get the final prediction from the readouts (force or energy)

output_type#
ffn#
final_output#
forward(features: torch.Tensor) torch.Tensor#

features: features from the backbone Shape ([num_nodes, hidden_size] or [num_nodes, max_neighbor, hidden_size])