65af003602d38cd1f324e0bcfce40c7f0987eec0,main.py,,main,#,41

Before Change


    rollouts.obs[0].copy_(obs)

    // These variables are used to compute average rewards for all processes.
    episode_rewards = torch.zeros([args.num_processes, 1])
    final_rewards = torch.zeros([args.num_processes, 1])

    rollouts.to(device)

    start = time.time()
    for j in range(num_updates):
        for step in range(args.num_steps):
            // Sample actions
            with torch.no_grad():
                value, action, action_log_prob, recurrent_hidden_states = actor_critic.act(
                        rollouts.obs[step],
                        rollouts.recurrent_hidden_states[step],
                        rollouts.masks[step])

            // Obser reward and next obs
            obs, reward, done, info = envs.step(action)
            episode_rewards += reward

            // If done then clean the history of observations.
            masks = torch.FloatTensor([[0.0] if done_ else [1.0] for done_ in done])
            final_rewards *= masks

After Change


            obs, reward, done, infos = envs.step(action)

            for info in infos:
                if "episode" in info.keys():
                    episode_rewards.append(info["episode"]["r"])

            // If done then clean the history of observations.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: ikostrikov/pytorch-a2c-ppo-acktr
Commit Name: 65af003602d38cd1f324e0bcfce40c7f0987eec0
Time: 2018-09-05
Author: ikostrikov@gmail.com
File Name: main.py
Class Name:
Method Name: main


Project Name: rail-berkeley/softlearning
Commit Name: 1113670b794b23c39cf23a9a532f866d08b63fdb
Time: 2018-06-30
Author: kristian.hartikainen@gmail.com
File Name: softlearning/replay_buffers/simple_replay_buffer.py
Class Name: SimpleReplayBuffer
Method Name: __init__


Project Name: idaholab/raven
Commit Name: 078b2512f26bfb20aa3ecbb6a065008bf7d45753
Time: 2020-06-30
Author: mohammad.abdo@inl.gov
File Name: framework/Optimizers/GeneticAlgorithm.py
Class Name: GeneticAlgorithm
Method Name: _useRealization