Advertisement
Guest User

Untitled

a guest
Aug 17th, 2019
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. class Net(nn.Module):
  2. def __init__(self):
  3. super(Net, self).__init__()
  4. self.conv1 = nn.Conv2d(1, 64, kernel_size=(3, 3), padding=1)
  5. self.conv2 = nn.Conv2d(64, 64, kernel_size=(3, 3), padding=1)
  6. self.max_pool = nn.MaxPool2d(2, 2)
  7. self.global_pool = nn.AvgPool2d(7)
  8. self.fc1 = nn.Linear(64, 64)
  9. self.fc2 = nn.Linear(64, 10)
  10.  
  11. def forward(self, x):
  12. x = F.relu(self.conv1(x))
  13. x = F.relu(self.conv2(x))
  14. x = self.max_pool(x)
  15.  
  16. x = F.relu(self.conv2(x))
  17. x = F.relu(self.conv2(x))
  18. x = self.max_pool(x)
  19.  
  20. x = F.relu(self.conv2(x))
  21. x = F.relu(self.conv2(x))
  22. x = self.global_pool(x)
  23.  
  24. x = x.view(-1, 64)
  25.  
  26. x = F.relu(self.fc1(x))
  27. x = self.fc2(x)
  28.  
  29. x = F.log_softmax(x)
  30.  
  31. return x
  32. model = Net()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement