One timestep for acting. obs (B,4,105,80), hx (B,gru). Returns logits, value, new hx.
(self, obs, hx, inc_entropy=None)
| 96 | return h |
| 97 | |
| 98 | def step(self, obs, hx, inc_entropy=None): |
| 99 | """One timestep for acting. obs (B,4,105,80), hx (B,gru). Returns |
| 100 | logits, value, new hx.""" |
| 101 | hx = self.gru(self.features(obs), hx) |
| 102 | logits = self.pi(hx) |
| 103 | if inc_entropy is not None: |
| 104 | logits = torch.where(inc_entropy.unsqueeze(1), logits / 2.0, logits) |
| 105 | return logits, self.v(hx).squeeze(-1), hx |
| 106 | |
| 107 | def unroll(self, obs_seq, hx0, done_seq): |
| 108 | """Recompute a (T,B) rollout's logits/values with done-masked GRU state |
no test coverage detected