Remove redundant parts in filenames (#213)
* Remove redundant parts in config filenames * Change `mnist_model.py` to `mnist_module.py` * Change `MNISTLitModel` to `MNISTLitModule` * Change folder `modules/` to `components/` * Update README
This commit is contained in:
1 parent
8b62eef9d0
commit
c4940edaec
15 files changed
+194
-195
No files matched your search
@@ -0,0 +1,27 @@
|
||||
from torch import nn
|
||||
|
||||
|
||||
class SimpleDenseNet(nn.Module):
|
||||
def __init__(self, hparams: dict):
|
||||
super().__init__()
|
||||
|
||||
self.model = nn.Sequential(
|
||||
nn.Linear(hparams["input_size"], hparams["lin1_size"]),
|
||||
nn.BatchNorm1d(hparams["lin1_size"]),
|
||||
nn.ReLU(),
|
||||
nn.Linear(hparams["lin1_size"], hparams["lin2_size"]),
|
||||
nn.BatchNorm1d(hparams["lin2_size"]),
|
||||
nn.ReLU(),
|
||||
nn.Linear(hparams["lin2_size"], hparams["lin3_size"]),
|
||||
nn.BatchNorm1d(hparams["lin3_size"]),
|
||||
nn.ReLU(),
|
||||
nn.Linear(hparams["lin3_size"], hparams["output_size"]),
|
||||
)
|
||||
|
||||
def forward(self, x):
|
||||
batch_size, channels, width, height = x.size()
|
||||
|
||||
# (batch, 1, width, height) -> (batch, 1*width*height)
|
||||
x = x.view(batch_size, -1)
|
||||
|
||||
return self.model(x)
|
||||
Reference in new issue
Block a user