Clarification on simple network using pytorch
Hi everyone, thanks for the great community. I was wondering whether could  someone provide some insights into how to construct a NN such as those in the examples on the github page but on its simplest form.  Let me explain with an example. For instance in the github page of examples one can find the following. <SCODE>import torch.nn as nn
import torch.nn.functional as F

class Net(nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.conv1 = nn.Conv2d(1, 6, 5) # 1 input image channel, 6 output channels, 5x5 square convolution kernel
        self.conv2 = nn.Conv2d(6, 16, 5)
        self.fc1   = nn.Linear(16*5*5, 120) # an affine operation: y = Wx + b
        self.fc2   = nn.Linear(120, 84)
        self.fc3   = nn.Linear(84, 10)

    def forward(self, x):
        x = F.max_pool2d(F.relu(self.conv1(x)), (2, 2)) # Max pooling over a (2, 2) window
        x = F.max_pool2d(F.relu(self.conv2(x)), 2) # If the size is a square you can only specify a single number
        x = x.view(-1, self.num_flat_features(x))
        x = F.relu(self.fc1(x))
        x = F.relu(self.fc2(x))
        x = self.fc3(x)
        return x

net = Net()
<ECODE> There are a couple of things here that are being obfuscated and might create confusion for newcomers. Thanks.
kirk86
apaszke
From your post, I see that you want to avoid classes and inheritance. You could look at Sergey Zagoruyko’s purely functional implementation of Wide ResNets:
smth
kirk86
I’m confused regarding the size of the max pooling window. Thanks
isalirezag
Exactly as you said it. The example is just to show both ways are valid. If you have pooling size of 2x2 you can simply use one number (2) instead of (2, 2). In other cases you might wanna have pooling of over different window/kernel sizes e.g. (2, 3).
kirk86