FrancescoSaverioZuppichini/Pytorch-how-and-when-to-use-Module-Sequential-ModuleList-and-ModuleDict

conv_blokcs aesthetically doesn't look good :)

ZumbiAzul opened this issue · 2 comments

It's not an issue, but from aesthetical point of view of a perfectionist, it looks better with conv_blocks instead of conv_blokcs :)

class MyCNNClassifier(nn.Module):
    def __init__(self, in_c, enc_sizes, n_classes):
        super().__init__()
        self.enc_sizes = [in_c, *enc_sizes]
        
        conv_blokcs = [conv_block(in_f, out_f, kernel_size=3, padding=1)  # here
                       for in_f, out_f in zip(self.enc_sizes, self.enc_sizes[1:])]
        
        self.encoder = nn.Sequential(*conv_blokcs) # here

        
        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

Yeah sure, it's a typo :) Thanks

You are welcome! I saw you have corrected it, but there are other chunks of code where this typo is still there!