Skip to content

Commit

Permalink
Merge pull request neuraloperator#183 from btolooshams/main
Browse files Browse the repository at this point in the history
MLP additional statement to check for scenario where n_layers=1
  • Loading branch information
JeanKossaifi committed Jul 22, 2023
2 parents e4b9ae6 + b369d7c commit 7f9ec18
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion neuralop/models/mlp.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@ def __init__(self, in_channels, out_channels=None, hidden_channels=None,
Conv = getattr(nn, f'Conv{n_dim}d')
self.fcs = nn.ModuleList()
for i in range(n_layers):
if i == 0:
if i == 0 and i == (n_layers - 1):
self.fcs.append(Conv(self.in_channels, self.out_channels, 1))
elif i == 0:
self.fcs.append(Conv(self.in_channels, self.hidden_channels, 1))
elif i == (n_layers - 1):
self.fcs.append(Conv(self.hidden_channels, self.out_channels, 1))
Expand Down

0 comments on commit 7f9ec18

Please sign in to comment.