| 43 | |
| 44 | |
| 45 | class QuantLeNet(nn.Module): |
| 46 | def __init__(self, **kwargs): |
| 47 | super(QuantLeNet, self).__init__() |
| 48 | self.conv1 = QuantConv2d(1, 10, kernel_size=5, **kwargs) |
| 49 | self.conv2 = QuantConv2d(10, 20, kernel_size=5, **kwargs) |
| 50 | self.fc1 = QuantLinear(320, 50, **kwargs) |
| 51 | self.fc2 = QuantLinear(50, 10, **kwargs) |
| 52 | |
| 53 | def forward(self, x): |
| 54 | x = F.relu(F.max_pool2d(self.conv1(x), 2)) |
| 55 | x = F.relu(F.max_pool2d(self.conv2(x), 2)) |
| 56 | x = x.view(-1, 320) |
| 57 | x = F.relu(self.fc1(x)) |
| 58 | x = F.dropout(x, training=self.training) |
| 59 | x = self.fc2(x) |
| 60 | return F.log_softmax(x, dim=1) |
| 61 | |
| 62 | @pytest.fixture |
| 63 | def resnet18(): |
no outgoing calls