human
I am working on the file "FADL1/cifar10_redux_pt-practice.ipynb".
The first task is:
That's it. Everything else will be identical.. except we can now do way more layers than before.
We're going to make it 3x as deep as before and it's going to train great, just because of that one line: x + super().forward(x)
Can you write Python program for it?
 Give me a the Python program you requested?
assistant
#Here is the Python program you requested.

class ResNet(nn.Module):
    def __init__(self, layers, c):
        super().__init__()
        self.conv1 = nn.Conv2d(3, 10, kernel_size=5, stride=1, padding=2)
        self.layers = nn.ModuleList([BnLayer(layers[i], layers[i+1])
                                     for i in range(len(layers) - 1)])
        self.layers2 = nn.ModuleList([ResnetLayer(layers[i+1], layers[i+1], 1)
                                      for i in range(len(layers) - 1)])
        self.layers3 = nn.ModuleList([ResnetLayer(layers[i+1], layers[i+1], 1)
                                      for i in range(len(layers) - 1)])
        self.out = nn.Linear(layers[-1], c)
        
    def forward(self, x):
        x = self.conv1(x)
        for λ, λ2, λ3 in zip(self.layers, self.layers2, self.layers3):
            x = λ3(λ3(λ(x)))
        x = F.adaptive_max_pool2d(x, 1)
        x = x.view(x.size(0), -1)
        return F.log_softmax(self.out(x), dim=-1)

learner = ConvLearner.from_model_data(ResNet([10,20,40,80,160],10), data)

# weight decay
wd = 1e-5

%time learner.fit(1e-2, 2, wds=wd)