forward of both actor and critic
(self, x)
| 52 | self.rewards = [] |
| 53 | |
| 54 | def forward(self, x): |
| 55 | """ |
| 56 | forward of both actor and critic |
| 57 | """ |
| 58 | x = F.relu(self.affine1(x)) |
| 59 | |
| 60 | # actor: choses action to take from state s_t |
| 61 | # by returning probability of each action |
| 62 | action_prob = F.softmax(self.action_head(x), dim=-1) |
| 63 | |
| 64 | # critic: evaluates being in the state s_t |
| 65 | state_values = self.value_head(x) |
| 66 | |
| 67 | # return values for both actor and critic as a tuple of 2 values: |
| 68 | # 1. a list with the probability of each action over the action space |
| 69 | # 2. the value from state s_t |
| 70 | return action_prob, state_values |
| 71 | |
| 72 | |
| 73 | model = Policy() |
nothing calls this directly
no outgoing calls
no test coverage detected