| 150 | class LeNet(torch.nn.Module): |
| 151 | |
| 152 | def __init__(self): |
| 153 | super().__init__() |
| 154 | # 1 input image channel (black & white), 6 output channels, 5x5 square convolution |
| 155 | # kernel |
| 156 | self.conv1 = torch.nn.Conv2d(1, 6, 5) |
| 157 | self.conv2 = torch.nn.Conv2d(6, 16, 3) |
| 158 | # an affine operation: y = Wx + b |
| 159 | self.fc1 = torch.nn.Linear(16 * 6 * 6, 120) # 6*6 from image dimension |
| 160 | self.fc2 = torch.nn.Linear(120, 84) |
| 161 | self.fc3 = torch.nn.Linear(84, 10) |
| 162 | |
| 163 | def forward(self, x): |
| 164 | # Max pooling over a (2, 2) window |