projects/p3_collab-compet/agent.py
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:
            for i in range(NUM_AGENTS):
                single_action = action[i]
                for j in single_action:
                    j += self.noise[i].sample()
        return np.clip(action, -1, 1)
Returns actions for given state as per current policy.
Returns actions for given state as per current policy.
Returns actions for given state as per current policy .
def act(self, state, add_noise=True):
        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:
            for i in range(NUM_AGENTS):
                single_action = action[i]
                for j in single_action:
                    j += self.noise[i].sample()
        return np.clip(action, -1, 1)
def act ( self , state , add_noise = True ) : 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 : for i in range ( NUM_AGENTS ) : single_action = action [ i ] for j in single_action : j += self . noise [ i ] . sample ( ) return np . clip ( action , - 1 , 1 )
Returns actions for given state as per current policy.
Returns actions for given state as per current policy .
"""Returns actions for given state as per current policy."""
self
state
add_noise