emmi.modules.encoder.mlp_encoder

Classes

MlpEncoder

A 2-layer MLP encoder. Can be use to encode (i.e., embed) the input data.

Module Contents

class emmi.modules.encoder.mlp_encoder.MlpEncoder(input_dim, hidden_dim, init_weights='truncnormal002')

Bases: torch.nn.Module

A 2-layer MLP encoder. Can be use to encode (i.e., embed) the input data.

Initialize the MlpEncoder.

Parameters:
  • input_dim (int) – Number of dimensions of the input tensor.

  • hidden_dim (int) – Hidden dimensionality of the network.

  • init_weights – Initialization method for the weight matrixes of the linear layers. Defaults to “truncnormal002”.

layer
forward(x)

Forward method of the MlpEncoder.

Parameters:

x – Tensor of input data.

Returns:

Embedded/encoded tensor.