Skip to content

Instantly share code, notes, and snippets.

@ikatsov
Last active February 13, 2020 04:21
Show Gist options
  • Select an option

  • Save ikatsov/d212797a303829bfa892a4823ca089cf to your computer and use it in GitHub Desktop.

Select an option

Save ikatsov/d212797a303829bfa892a4823ca089cf to your computer and use it in GitHub Desktop.
class PolicyNetworkDQN(nn.Module):
def __init__(self, state_size, action_size, hidden_size=128):
super(PolicyNetworkDQN, self).__init__()
layers = [
nn.Linear(state_size, hidden_size), # simple network with 4 layers
nn.ReLU(),
nn.Linear(hidden_size, hidden_size),
nn.ReLU(),
nn.Linear(hidden_size, hidden_size),
nn.ReLU(),
nn.Linear(hidden_size, action_size)
]
self.model = nn.Sequential(*layers)
def forward(self, x):
q_values = self.model(x)
return q_values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment