I’m looking at the convnet example in 60-min blitz tutorial, and it’s not obvious to me how the layers were grouped into init and forward functions. For example, why convolutional layers are in init, but pooling layers are in forward?
Where should I define a dropout layer, or a batchnorm layer? Is this explained somewhere?
class Net(nn.Module):      
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(1, 6, 5)
        self.conv2 = nn.Conv2d(6, 16, 5)
        self.fc1 = nn.Linear(16*5*5, 120)
        self.fc2 = nn.Linear(120, 10)
        
    def forward(self, x):
        x = F.max_pool2d(F.relu(self.conv1(x)), (2,2))
        x = F.max_pool2d(F.relu(self.conv2(x)), 2)    
        x = x.view(x.size(0), -1)
        x = F.relu(self.fc1(x))
        x = self.fc2(x)
        
        return x

Thanks!