(self, layer_config)
| 45 | raise NotImplementedError(f"Unsupported layer type: {layer_config['type']}") |
| 46 | |
| 47 | def _build_mlp_layer(self, layer_config): |
| 48 | layers = [] |
| 49 | hidden_dims = layer_config['hidden_dims'] |
| 50 | output_dim = self.output_dim |
| 51 | activation = getattr(nn, layer_config['activation'])() |
| 52 | |
| 53 | layers.append(nn.Linear(self.input_dim, hidden_dims[0])) |
| 54 | layers.append(activation) |
| 55 | |
| 56 | for l in range(len(hidden_dims)): |
| 57 | if l == len(hidden_dims) - 1: |
| 58 | layers.append(nn.Linear(hidden_dims[l], output_dim)) |
| 59 | else: |
| 60 | layers.append(nn.Linear(hidden_dims[l], hidden_dims[l + 1])) |
| 61 | layers.append(activation) |
| 62 | |
| 63 | self.module = nn.Sequential(*layers) |
| 64 | |
| 65 | def forward(self, input): |
| 66 | return self.module(input) |
no outgoing calls
no test coverage detected