Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def act(self, state, add_noise=True):
- """Returns actions for given state as per current policy."""
- state = torch.from_numpy(state).float().to(device)
- self.actor_local.eval()
- with torch.no_grad():
- action = self.actor_local(state).cpu().data.numpy()
- self.actor_local.train()
- if add_noise:
- action += self.noise.sample()
- return np.clip(action, -1, 1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement