MCPcopy Create free account
hub / github.com/pytorch/tutorials / Net

Class Net

beginner_source/introyt/tensorboardyt_tutorial.py:158–175  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

156#
157
158class Net(nn.Module):
159 def __init__(self):
160 super().__init__()
161 self.conv1 = nn.Conv2d(1, 6, 5)
162 self.pool = nn.MaxPool2d(2, 2)
163 self.conv2 = nn.Conv2d(6, 16, 5)
164 self.fc1 = nn.Linear(16 * 4 * 4, 120)
165 self.fc2 = nn.Linear(120, 84)
166 self.fc3 = nn.Linear(84, 10)
167
168 def forward(self, x):
169 x = self.pool(F.relu(self.conv1(x)))
170 x = self.pool(F.relu(self.conv2(x)))
171 x = x.view(-1, 16 * 4 * 4)
172 x = F.relu(self.fc1(x))
173 x = F.relu(self.fc2(x))
174 x = self.fc3(x)
175 return x
176
177
178net = Net()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected