MCPcopy Index your code
hub / github.com/pytorch/tutorials / DQN

Class DQN

intermediate_source/reinforcement_q_learning.py:229–242  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227#
228
229class DQN(nn.Module):
230
231 def __init__(self, n_observations, n_actions):
232 super(DQN, self).__init__()
233 self.layer1 = nn.Linear(n_observations, 128)
234 self.layer2 = nn.Linear(128, 128)
235 self.layer3 = nn.Linear(128, n_actions)
236
237 # Called with either one element to determine next action, or a batch
238 # during optimization. Returns tensor([[left0exp,right0exp]...]).
239 def forward(self, x):
240 x = F.relu(self.layer1(x))
241 x = F.relu(self.layer2(x))
242 return self.layer3(x)
243
244
245######################################################################

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected