import torch.nn as nn class MyCnnModel(nn.Module): def __init__(self): super().__init__() self.network = nn.Sequential( nn.Conv2d(3, 32, 3, padding='same'), nn.ReLU(), nn.Conv2d(32, 64, 3, padding='same'), nn.ReLU(), nn.MaxPool2d(2, 2), nn.BatchNorm2d(64), nn.Conv2d(64, 128, 3, padding='same'), nn.ReLU(), nn.Conv2d(128, 128, 3, padding='same'), nn.ReLU(), nn.MaxPool2d(2, 2), nn.BatchNorm2d(128), nn.Conv2d(128, 256, 3, padding='same'), nn.ReLU(), nn.Conv2d(256, 256, 3, padding='same'), nn.ReLU(), nn.MaxPool2d(2, 2), nn.BatchNorm2d(256), nn.Flatten(), nn.Linear(256*4*4, 512), nn.ReLU(), nn.Linear(512, 10)) def forward(self, xb): return self.network(xb)