| import torch | |
| import torch.nn as nn | |
| import torch.nn.functional as F | |
| class Net(nn.Module): | |
| def __init__(self): | |
| super().__init__() | |
| self.conv1 = nn.Conv2d(3, 1, 1) | |
| self.fc1 = nn.Linear(1024, 10) | |
| def forward(self, x): | |
| x = F.relu(self.conv1(x)) | |
| x = torch.flatten(x, 1) | |
| x = F.relu(self.fc1(x)) | |
| return x |