megatron.model.transformer.ParallelMLP#

class megatron.model.transformer.ParallelMLP(init_method, output_layer_init_method, args, world_size)#

Bases: MegatronModule

MLP.

MLP will take the input with h hidden state, project it to 4*h hidden dimension, perform nonlinear transformation, and project the state back into h hidden dimension.

forward(hidden_states)#

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 Module instance afterwards instead of this since the former takes care of running the registered hooks while the latter silently ignores them.