cd75ce793e3e01a5e4db513480e9109676fd3fee,slm_lab/agent/algorithm/sarsa.py,SARSA,act,#SARSA#Any#,102

Before Change


            state = policy_util.update_online_stats_and_normalize_state(body, state)
        action, action_pd = self.action_policy(state, self, body)
        // sum for single and multi-action
        body.entropies.append(action_pd.entropy().sum(dim=0))
        body.log_probs.append(action_pd.log_prob(action.float()).sum(dim=0))
        assert not torch.isnan(body.log_probs[-1])
        if len(action.shape) == 0:  // scalar
            return action.cpu().numpy().astype(body.action_space.dtype).item()

After Change


        if self.normalize_state:
            state = policy_util.update_online_stats_and_normalize_state(body, state)
        action, action_pd = self.action_policy(state, self, body)
        body.action_tensor, body.action_pd = action, action_pd  // used for body.action_pd_update later
        if len(action.shape) == 0:  // scalar
            return action.cpu().numpy().astype(body.action_space.dtype).item()
        else:
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: kengz/SLM-Lab
Commit Name: cd75ce793e3e01a5e4db513480e9109676fd3fee
Time: 2019-02-02
Author: kengzwl@gmail.com
File Name: slm_lab/agent/algorithm/sarsa.py
Class Name: SARSA
Method Name: act


Project Name: kengz/SLM-Lab
Commit Name: cd75ce793e3e01a5e4db513480e9109676fd3fee
Time: 2019-02-02
Author: kengzwl@gmail.com
File Name: slm_lab/agent/algorithm/hydra_dqn.py
Class Name: HydraDQN
Method Name: space_act


Project Name: kengz/SLM-Lab
Commit Name: cd75ce793e3e01a5e4db513480e9109676fd3fee
Time: 2019-02-02
Author: kengzwl@gmail.com
File Name: slm_lab/agent/algorithm/reinforce.py
Class Name: Reinforce
Method Name: act