Spaces:
Sleeping
Sleeping
import torch.nn as nn | |
import torch.nn.functional as F | |
class FeedForwardClassifier(nn.Module): | |
def __init__(self, input_size): | |
super(FeedForwardClassifier, self).__init__() | |
self.fc1 = nn.Linear(in_features=input_size, out_features=600) | |
self.drop1 = nn.Dropout(0.25) | |
self.fc2 = nn.Linear(in_features=600, out_features=120) | |
self.drop2 = nn.Dropout(0.25) | |
self.fc3 = nn.Linear(in_features=120, out_features=10) | |
def forward(self, x): | |
x = x.view(x.size(0), -1) # Flatten the input | |
x = F.relu(self.fc1(x)) | |
x = self.drop1(x) | |
x = F.relu(self.fc2(x)) | |
x = self.drop2(x) | |
x = self.fc3(x) | |
return x | |