| 25 | from pytorch_quantization.tensor_quant import QuantDescriptor |
| 26 | |
| 27 | class LeNet(nn.Module): |
| 28 | def __init__(self, **kwargs): |
| 29 | super(LeNet, self).__init__() |
| 30 | self.conv1 = nn.Conv2d(1, 10, kernel_size=5, **kwargs) |
| 31 | self.conv2 = nn.Conv2d(10, 20, kernel_size=5, **kwargs) |
| 32 | self.fc1 = nn.Linear(320, 50, **kwargs) |
| 33 | self.fc2 = nn.Linear(50, 10, **kwargs) |
| 34 | |
| 35 | def forward(self, x): |
| 36 | x = F.relu(F.max_pool2d(self.conv1(x), 2)) |
| 37 | x = F.relu(F.max_pool2d(self.conv2(x), 2)) |
| 38 | x = x.view(-1, 320) |
| 39 | x = F.relu(self.fc1(x)) |
| 40 | x = F.dropout(x, training=self.training) |
| 41 | x = self.fc2(x) |
| 42 | return F.log_softmax(x, dim=1) |
| 43 | |
| 44 | |
| 45 | class QuantLeNet(nn.Module): |
no outgoing calls