(self, channels)
| 162 | |
| 163 | class MLP(nn.Module): |
| 164 | def __init__(self, channels): |
| 165 | super().__init__() |
| 166 | self.mlp = nn.ModuleList() |
| 167 | for cc in range(len(channels) - 2): |
| 168 | self.mlp.append( |
| 169 | nn.Sequential( |
| 170 | nn.Linear( |
| 171 | channels[cc], |
| 172 | channels[cc + 1], |
| 173 | bias=False), |
| 174 | build_norm_layer( |
| 175 | dict(type='LN'), channels[cc + 1])[1], |
| 176 | build_activation_layer( |
| 177 | dict(type='GELU')))) |
| 178 | self.mlp.append( |
| 179 | nn.Linear(channels[-2], channels[-1])) |
| 180 | |
| 181 | def forward(self, input): |
| 182 | for layer in self.mlp: |