File size: 502 Bytes
5ef3075 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
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 |