| 59 | |
| 60 | class MLP(nn.Module): |
| 61 | def __init__(self, input_size, hidden_size=[32,32,32,32], dropout=0.0): |
| 62 | |
| 63 | super(MLP, self).__init__() |
| 64 | self.nonlinearity = nn.ReLU() |
| 65 | self.fc = nn.ModuleList([nn.Linear(in_features=input_size, out_features=hidden_size[0])]) |
| 66 | for d_out in hidden_size[1:]: |
| 67 | self.fc.append(nn.Linear(in_features=self.fc[-1].out_features, out_features=d_out)) |
| 68 | self.out_features = hidden_size[-1] |
| 69 | self.dropout = nn.Dropout(dropout) |
| 70 | def forward(self,x): |
| 71 | |
| 72 | for fc in self.fc[:-1]: |