| 23 | return self.forward(state).numpy()[0] |
| 24 | |
| 25 | class Critic(nn.Layer): |
| 26 | def __init__(self, state_dim, action_dim): |
| 27 | super(Critic, self).__init__() |
| 28 | |
| 29 | self.l1 = nn.Linear(state_dim, 400) |
| 30 | self.l2 = nn.Linear(400 + action_dim, 300) |
| 31 | self.l3 = nn.Linear(300, 1) |
| 32 | |
| 33 | def forward(self, state, action): |
| 34 | q = F.relu(self.l1(state)) |
| 35 | q = F.relu(self.l2(paddle.concat([q, action], 1))) |
| 36 | |
| 37 | return self.l3(q) |