sarraarab's picture
Upload 4 files
b6b65ad verified
raw
history blame contribute delete
656 Bytes
import torch
import torch.nn as nn
class SimpleCNN(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Sequential(
nn.Conv2d(3, 16, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
nn.Conv2d(16, 32, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
nn.Conv2d(32, 64, 3, padding=1), nn.ReLU(), nn.MaxPool2d(2),
)
self.fc = nn.Sequential(
nn.Flatten(),
nn.Linear(64 * 32 * 32, 128),
nn.ReLU(),
nn.Linear(128, 3)
)
def forward(self, x):
x = self.conv(x)
x = self.fc(x)
return x