| 227 | # |
| 228 | |
| 229 | class 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 | ###################################################################### |
no outgoing calls
no test coverage detected