EMNIST-Letters-CNN / model.py
Mehriddin1997's picture
Upload 2 files
3230f9d verified
import torch
import torch.nn as nn
class LetterCNN(nn.Module):
def __init__(self):
super().__init__()
self.conv = nn.Sequential(
nn.Conv2d(1, 16, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
nn.Conv2d(16, 32, 3, padding=1),
nn.ReLU(),
nn.MaxPool2d(2),
)
self.fc = nn.Sequential(
nn.Linear(32*7*7, 128),
nn.ReLU(),
nn.Linear(128, 26)
)
def forward(self, x):
x = self.conv(x)
x = x.view(-1, 32*7*7)
return self.fc(x)