Skip to content

Instantly share code, notes, and snippets.

@ayulockin
Created May 8, 2020 15:32
Show Gist options
  • Save ayulockin/4ac4c99e34027bc985aed55d7f165441 to your computer and use it in GitHub Desktop.
Save ayulockin/4ac4c99e34027bc985aed55d7f165441 to your computer and use it in GitHub Desktop.
class Net(nn.Module):
def __init__(self):
super(Net, self).__init__()
self.conv1 = nn.Conv2d(3, 32, 3, 1)
torch.nn.init.kaiming_uniform_(self.conv1.weight, mode='fan_in', nonlinearity='relu')
self.conv2 = nn.Conv2d(32, 32, 3, 1)
torch.nn.init.kaiming_uniform_(self.conv2.weight, mode='fan_in', nonlinearity='relu')
self.conv3 = nn.Conv2d(32, 64, 3, 1)
torch.nn.init.kaiming_uniform_(self.conv3.weight, mode='fan_in', nonlinearity='relu')
self.conv4 = nn.Conv2d(64, 64, 3, 1)
torch.nn.init.kaiming_uniform_(self.conv4.weight, mode='fan_in', nonlinearity='relu')
self.pool1 = torch.nn.MaxPool2d(2)
self.pool2 = torch.nn.MaxPool2d(2)
self.fc1 = nn.Linear(1600, 512)
self.fc2 = nn.Linear(512, 128)
self.fc3 = nn.Linear(128, 10)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment