MCPcopy Create free account
hub / github.com/NVIDIA/TensorRT / LeNet

Class LeNet

tools/pytorch-quantization/tests/fixtures/models.py:27–42  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

25from pytorch_quantization.tensor_quant import QuantDescriptor
26
27class 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
45class QuantLeNet(nn.Module):

Callers 2

test_aspMethod · 0.90

Calls

no outgoing calls

Tested by 2

test_aspMethod · 0.72