import torch.nn as nn | |
import torch.nn.functional as F | |
class MultiLayerClassifier(nn.Module): | |
def __init__(self, input_size, num_classes): | |
super(MultiLayerClassifier, self).__init__() | |
self.fc1 = nn.Linear(input_size, 128, bias=True) | |
self.dropout1 = nn.Dropout(0.5) | |
self.fc2 = nn.Linear(128, num_classes, bias=True) | |
def forward(self, x): | |
x = F.relu(self.fc1(x)) | |
x = self.dropout1(x) | |
x = self.fc2(x) | |
return x |