Skip to content

Instantly share code, notes, and snippets.

@vsay01
Created January 22, 2020 01:59
Show Gist options
  • Save vsay01/80e1d915c838ec865e910826424ac8c4 to your computer and use it in GitHub Desktop.
Save vsay01/80e1d915c838ec865e910826424ac8c4 to your computer and use it in GitHub Desktop.
FashionClassifier model
# Define your network ( Simple Example )
class FashionClassifier(nn.Module):
def __init__(self):
super().__init__()
input_size = 784
self.fc1 = nn.Linear(input_size, 512)
self.fc2 = nn.Linear(512, 256)
self.fc3 = nn.Linear(256, 128)
self.fc4 = nn.Linear(128, 64)
self.fc5 = nn.Linear(64,10)
self.dropout = nn.Dropout(p=0.2)
def forward(self, x):
x = x.view(x.shape[0], -1)
x = self.dropout(F.relu(self.fc1(x)))
x = self.dropout(F.relu(self.fc2(x)))
x = self.dropout(F.relu(self.fc3(x)))
x = self.dropout(F.relu(self.fc4(x)))
x = F.log_softmax(self.fc5(x), dim=1)
return x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment