human
I am working on the file "FADL1/L7CA_lesson7-cifar10.ipynb".
The first task is:
The goal is to basically replicated the basic architecture of a ResNet. The simple model above gets an accuracy of around 47%, with 120,000 parameters. Not great. We're deffinitely not using our parameters very well -- they're treating each pixel with a different weight.
Instead we'll find groups of 3x3 pixels with particular patterns, using a ConvNet.
3. CNN
The first step is to replace our FullNet model with a ConvNet model.
Can you write Python program for it?

=====
Give me a Python program to find groups of 3x3 pixels with particular patterns, using a ConvNet?
assistant
#Here is Python program to find groups of 3x3 pixels with particular patterns, using a ConvNet.

class ConvNet(nn.Module):
    def __init__(self, layers, c):
        super().__init__()
        self.layers = nn.ModuleList([
            nn.Conv2d(layers[i], layers[i + 1], kernel_size=3, stride=2)
            for i in range(len(layers) - 1)])
        self.pool = nn.AdaptiveMaxPool2d(1)
        self.out = nn.Linear(layers[-1], c)
    
    def forward(self, x):
        for λ in self.layers: x = F.relu(λ(x))
        x = self.pool(x)
        x = x.view(x.size(0), -1)
        return F.log_softmax(self.out(x), dim=-1)