9634be247a33280cfc60b439e6cb61147bd79f56,softqlearning/misc/sampler.py,,rollout,#Any#Any#Any#Any#Any#,7

Before Change


    concat_infos = dict()
    for key in all_infos[0].keys():
        all_vals = [np.array(info[key])[None] for info in all_infos]
        concat_infos[key] = np.concatenate(all_vals)

    path = dict(
        last_obs=last_obs,
        dones=terminals[:t + 1],

After Change


    actions = np.zeros((path_length, Da))
    terminals = np.zeros((path_length, ))
    rewards = np.zeros((path_length, ))
    agent_infos = []
    env_infos = []

    t = 0
    for t in range(path_length):

        action, agent_info = policy.get_action(observation)
        next_obs, reward, terminal, env_info = env.step(action)

        agent_infos.append(agent_info)
        env_infos.append(env_info)

        actions[t] = action
        terminals[t] = terminal
        rewards[t] = reward
        observations[t] = observation

        observation = next_obs

        if render:
            env.render()
            time_step = 0.05
            time.sleep(time_step / speedup)

        if terminal:
            break

    observations[t + 1] = observation

    path = {
        "observations": observations[:t + 1],
        "actions": actions[:t + 1],
        "rewards": rewards[:t + 1],
        "terminals": terminals[:t + 1],
        "next_observations": observations[1:t + 2],
        "agent_infos": agent_infos,
        "env_infos": env_infos
    }

    return path

Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: rail-berkeley/softlearning
Commit Name: 9634be247a33280cfc60b439e6cb61147bd79f56
Time: 2018-01-29
Author: haarnoja@berkeley.edu
File Name: softqlearning/misc/sampler.py
Class Name:
Method Name: rollout


Project Name: kymatio/kymatio
Commit Name: 82c7dbed39a2aa1e1f980cda78cc31a823dbe349
Time: 2020-02-18
Author: janden@flatironinstitute.org
File Name: kymatio/scattering2d/core/scattering2d.py
Class Name:
Method Name: scattering2d


Project Name: liyaguang/DCRNN
Commit Name: 5dc36fed7cb3e31a3f44b99ddd6d870840c885ce
Time: 2018-09-30
Author: liyaguang0123@gmail.com
File Name: model/dcrnn_supervisor.py
Class Name: DCRNNSupervisor
Method Name: test_and_write_result