import torch.nn as nn

# ============================================================
# CNN model
# ============================================================

class DominoCNN_1layer(nn.Module):
    def __init__(self, num_classes: int = 28):
        super().__init__()

        self.features = nn.Sequential(
            nn.Conv2d(3, 16, kernel_size=3, padding=1),   # [Batch_size, 16, 75, 100]
            nn.BatchNorm2d(16),
            nn.ReLU(inplace=True),
            nn.MaxPool2d(2),                              # [Batch_size, 16, 37, 50]
        )

        self.classifier = nn.Sequential(
            nn.Flatten(),
            nn.Linear(16 * 37 * 50, 128),
            nn.ReLU(inplace=True),
            nn.Dropout(0.5),
            nn.Linear(128, num_classes),
        )

    def forward(self, x):
        x = self.features(x)
        x = self.classifier(x)
        return x

