MCPcopy Create free account
hub / github.com/pytorch/examples / forward

Method forward

distributed/rpc/parameter_server/rpc_parameter_server.py:43–60  ·  view source on GitHub ↗
(self, x)

Source from the content-addressed store, hash-verified

41 self.fc2 = nn.Linear(128, 10).to(device)
42
43 def forward(self, x):
44 x = self.conv1(x)
45 x = F.relu(x)
46 x = self.conv2(x)
47 x = F.max_pool2d(x, 2)
48
49 x = self.dropout1(x)
50 x = torch.flatten(x, 1)
51 # Move tensor to next device if necessary
52 next_device = next(self.fc1.parameters()).device
53 x = x.to(next_device)
54
55 x = self.fc1(x)
56 x = F.relu(x)
57 x = self.dropout2(x)
58 x = self.fc2(x)
59 output = F.log_softmax(x, dim=1)
60 return output
61
62
63# --------- Helper Methods --------------------

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected