Skip to content

Instantly share code, notes, and snippets.

@neale
Last active March 21, 2017 07:12
Show Gist options
  • Save neale/1d62923c2d4c833b783b992ecdcaa9e3 to your computer and use it in GitHub Desktop.
Save neale/1d62923c2d4c833b783b992ecdcaa9e3 to your computer and use it in GitHub Desktop.
class DQN(object):
def __init__(self, input, num_actions):
self.conv1 = nn.Conv2d(input, 32, 3, stride=2, padding=1)
self.conv2 = nn.Conv2d(input, 32, 3, stride=2, padding=1)
self.conv3 = nn.Conv2d(input, 32, 3, stride=2, padding=1)
self.linear = nn.Linear(256, num_actions)
""" initialize weights"""
def forward(self, inputs):
x = nn.elu(self.conv1(inputs))
x = nn.elu(self.conv2(x))
x = nn.elu(self.conv3(x))
x = x.view(-1, 32 * 3 * 3)
return self.linear(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment