(self, input_dim, hidden_dim, output_dim, num_layers)
| 89 | class MLP(nn.Module): |
| 90 | """Very simple multi-layer perceptron (also called FFN)""" |
| 91 | def __init__(self, input_dim, hidden_dim, output_dim, num_layers): |
| 92 | super().__init__() |
| 93 | self.num_layers = num_layers |
| 94 | h = [hidden_dim] * (num_layers - 1) |
| 95 | self.layers = nn.ModuleList( |
| 96 | nn.Linear(n, k) for n, k in zip([input_dim] + h, h + [output_dim])) |
| 97 | |
| 98 | def forward(self, x): |
| 99 | for i, layer in enumerate(self.layers): |