MCPcopy Create free account
hub / github.com/rlcode/reinforcement-learning / __init__

Method __init__

3-atari/1-dqn.py:40–51  ·  view source on GitHub ↗
(self, n_actions)

Source from the content-addressed store, hash-verified

38# Standard Nature CNN.
39class QNetwork(nn.Module):
40 def __init__(self, n_actions):
41 super().__init__()
42 self.conv = nn.Sequential(
43 nn.Conv2d(4, 32, kernel_size=8, stride=4), nn.ReLU(),
44 nn.Conv2d(32, 64, kernel_size=4, stride=2), nn.ReLU(),
45 nn.Conv2d(64, 64, kernel_size=3, stride=1), nn.ReLU(),
46 nn.Flatten(),
47 )
48 self.fc = nn.Sequential(
49 nn.Linear(64 * 7 * 7, 512), nn.ReLU(),
50 nn.Linear(512, n_actions),
51 )
52
53 def forward(self, x):
54 # Inputs are uint8 in [0, 255]; normalize on the GPU to save bus bandwidth.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected