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

Class NeuralNetwork

beginner_source/basics/quickstart_tutorial.py:94–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92
93# Define model
94class NeuralNetwork(nn.Module):
95 def __init__(self):
96 super().__init__()
97 self.flatten = nn.Flatten()
98 self.linear_relu_stack = nn.Sequential(
99 nn.Linear(28*28, 512),
100 nn.ReLU(),
101 nn.Linear(512, 512),
102 nn.ReLU(),
103 nn.Linear(512, 10)
104 )
105
106 def forward(self, x):
107 x = self.flatten(x)
108 logits = self.linear_relu_stack(x)
109 return logits
110
111model = NeuralNetwork().to(device)
112print(model)

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected