Advertisement
Guest User

Untitled

a guest
Jul 24th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. def act(self, state, add_noise=True):
  2. """Returns actions for given state as per current policy."""
  3. state = torch.from_numpy(state).float().to(device)
  4. self.actor_local.eval()
  5. with torch.no_grad():
  6. action = self.actor_local(state).cpu().data.numpy()
  7. self.actor_local.train()
  8. if add_noise:
  9. action += self.noise.sample()
  10. return np.clip(action, -1, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement