human
2. Network Definition"
Please write code following the instructions in jupyter notebook style.
assistant
#Here is code to 2.

class FullNet(torch.nn.Module):
    def __init__(self, layers):
        super().__init__()
        self.layers = torch.nn.ModuleList([
            torch.nn.Linear(layers[i], layers[i+1]) for i in range(len(layers) - 1)
        ])
    def forward(self, x):
        x = x.view(x.size(0), -1)
        for layer in self.layers:
            layer_x = layer(x)
            x = torch.nn.functional.relu(layer_x) # NOTE we dont use relu as last actvn
        return torch.nn.functional.log_softmax(layer_x, dim=-1) # but we DO take the last layer's output

layers = [1*28*28, 40, 10] # MNIST dims: torch.Size([1, 28, 28]
network = FullNet(layers)

network

[param.numel() for param in network.parameters()]