MCPcopy Index your code
hub / github.com/patrickloeber/pytorchTutorial / NeuralNet1

Class NeuralNet1

11_softmax_and_crossentropy.py:106–119  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

104
105# Binary classification
106class NeuralNet1(nn.Module):
107 def __init__(self, input_size, hidden_size):
108 super(NeuralNet1, self).__init__()
109 self.linear1 = nn.Linear(input_size, hidden_size)
110 self.relu = nn.ReLU()
111 self.linear2 = nn.Linear(hidden_size, 1)
112
113 def forward(self, x):
114 out = self.linear1(x)
115 out = self.relu(out)
116 out = self.linear2(out)
117 # sigmoid at the end
118 y_pred = torch.sigmoid(out)
119 return y_pred
120
121model = NeuralNet1(input_size=28*28, hidden_size=5)
122criterion = nn.BCELoss()

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected