import torch from torch import nn class MiniVisionV3(nn.Module): def __init__(self): super().__init__() self.model = nn.Sequential( nn.Conv2d(1, 32, 3, padding=1), nn.BatchNorm2d(32), nn.ReLU(), nn.MaxPool2d(2), nn.Conv2d(32, 64, 3, padding=1), nn.BatchNorm2d(64), nn.ReLU(), nn.MaxPool2d(2), nn.Conv2d(64, 128, 3, padding=1), nn.BatchNorm2d(128), nn.ReLU(), nn.MaxPool2d(2), nn.Flatten(), nn.Linear(1152, 256), nn.ReLU(), nn.Dropout(0.3), nn.Linear(256, 47), ) def forward(self, x): x = self.model(x) return x if __name__ == '__main__': minivisionv3 = MiniVisionV3() total_params = sum(param.numel() for param in minivisionv3.parameters()) print(f"Total params: {total_params / 1000000: .2f}M") # with torch.no_grad(): # input = torch.randn(256, 1, 28, 28) # output = minivisionv3(input) # print(output)