-
-
Save FrancescoSaverioZuppichini/bccd56668c88ec62a0705978d381c10e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyCNNClassifier(nn.Module): | |
def __init__(self, in_c, n_classes): | |
super().__init__() | |
self.encoder = nn.Sequential( | |
conv_block(in_c, 32, kernel_size=3, padding=1), | |
conv_block(32, 64, kernel_size=3, padding=1) | |
) | |
self.decoder = nn.Sequential( | |
nn.Linear(32 * 28 * 28, 1024), | |
nn.Sigmoid(), | |
nn.Linear(1024, n_classes) | |
) | |
def forward(self, x): | |
x = self.encoder(x) | |
x = x.view(x.size(0), -1) # flat | |
x = self.decoder(x) | |
return x |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment