MCPcopy Index your code
hub / github.com/pytorch/tutorials / Net

Class Net

beginner_source/hyperparameter_tuning_tutorial.py:107–124  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

105# can search over:
106
107class Net(nn.Module):
108 def __init__(self, l1=120, l2=84):
109 super().__init__()
110 self.conv1 = nn.Conv2d(3, 6, 5)
111 self.pool = nn.MaxPool2d(2, 2)
112 self.conv2 = nn.Conv2d(6, 16, 5)
113 self.fc1 = nn.Linear(16 * 5 * 5, l1)
114 self.fc2 = nn.Linear(l1, l2)
115 self.fc3 = nn.Linear(l2, 10)
116
117 def forward(self, x):
118 x = self.pool(F.relu(self.conv1(x)))
119 x = self.pool(F.relu(self.conv2(x)))
120 x = torch.flatten(x, 1) # flatten all dimensions except batch
121 x = F.relu(self.fc1(x))
122 x = F.relu(self.fc2(x))
123 x = self.fc3(x)
124 return x
125
126######################################################################
127# Define the search space

Callers 2

train_cifarFunction · 0.70
mainFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected