Network Blocks
This page describe various classes defining neural net layers used by the emulator.
- class mentat_lss.models.blocks.activation_function(d: int)[source]
Custom nonlinear activation function
- class mentat_lss.models.blocks.block_addnorm(shape, dropout_prob=0.0)[source]
- forward(X, Y)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.
- class mentat_lss.models.blocks.block_resnet(input_dim: int, output_dim: int, num_layers: int, skip_connection: bool = True)[source]
- class mentat_lss.models.blocks.block_transformer_encoder(embedding_dim: int, split_dim: int, dropout_prob=0.0)[source]
Custom transformer encoder class
- class mentat_lss.models.blocks.linear_with_channels(input_dim: int, output_dim: int, num_channels: int)[source]
Class for independent MLP layers passed-through in parallel
- class mentat_lss.models.blocks.multi_headed_attention(hidden_dim, num_heads=2, dropout_prob=0.0)[source]
- forward(queries, keys, values)[source]
Define the computation performed at every call.
Should be overridden by all subclasses.
Note
Although the recipe for forward pass needs to be defined within this function, one should call the
Moduleinstance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.