import torch.nn as nn class TumorClassification(nn.Module): def __init__(self): super().__init__() self.model = nn.Sequential( nn.Conv2d(1, 32, 3, 1, 1), # con1d nn.ReLU(), nn.MaxPool2d(2), nn.Conv2d(32, 64, 3, 1, 1), # con2d nn.ReLU(), nn.MaxPool2d(2), nn.Conv2d(64, 128, 3, 1, 1), # con3d nn.ReLU(), nn.MaxPool2d(2), nn.Flatten(), nn.Linear(128 * 26 * 26, 512), # 128×26×26 = 86528 nn.ReLU(), nn.Linear(512, 4) # 4 classes ) def forward(self, x): return self.model(x) class GliomaStageModel(nn.Module): def __init__(self): super().__init__() self.fc1 = nn.Linear(9, 100) self.fc2 = nn.Linear(100, 50) self.fc3 = nn.Linear(50, 30) self.out = nn.Linear(30, 4) # 4 stages def forward(self, x): x = nn.functional.relu(self.fc1(x)) x = nn.functional.relu(self.fc2(x)) x = nn.functional.relu(self.fc3(x)) return self.out(x)