Spaces:
Runtime error
Runtime error
| import torch | |
| import torch.nn as nn | |
| class Net(nn.Module): | |
| def __init__(self): | |
| super(Net, self).__init__() | |
| self.conv1 = nn.Conv2d(3, 16, 3, padding=1) | |
| self.conv2 = nn.Conv2d(16, 32, 3, padding=1) | |
| self.conv3 = nn.Conv2d(32, 64, 3, padding=1) | |
| self.pool = nn.MaxPool2d(2, 2) | |
| self.fc1 = nn.Linear(64 * 28 * 28, 512) | |
| self.fc2 = nn.Linear(512, 7) | |
| self.dropout = nn.Dropout(0.2) | |
| def forward(self, x): | |
| x = self.pool(F.relu(self.conv1(x))) | |
| x = self.pool(F.relu(self.conv2(x))) | |
| x = self.pool(F.relu(self.conv3(x))) | |
| x = x.view(-1, 64 * 28 * 28) | |
| x = self.dropout(F.relu(self.fc1(x))) | |
| x = self.fc2(x) | |
| return x |