(self, x)
| 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 -------------------- |
nothing calls this directly
no outgoing calls
no test coverage detected