72313bc158d57e1f36e2c17848338a3079982def,ch16/01_cartpole_es.py,,train_step,#,69

Before Change


    opt.zero_grad()
    for p, p_update in zip(net.parameters(), weighted_noise):
        update = p_update / (len(batch_reward) * NOISE_STD)
        p.grad = Variable(update)
//        p.data += LEARNING_RATE * update
//        m_updates.append(torch.norm(update))
    opt.step()
    writer.add_scalar("update_l2", np.mean(m_updates), step_idx)

After Change


    for p, p_update in zip(net.parameters(), weighted_noise):
        update = p_update / (len(batch_reward) * NOISE_STD)
        p.data += LEARNING_RATE * update
        m_updates.append(torch.norm(update))
    writer.add_scalar("update_l2", np.mean(m_updates), step_idx)


if __name__ == "__main__":
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 3

Instances


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: 72313bc158d57e1f36e2c17848338a3079982def
Time: 2018-02-20
Author: max.lapan@gmail.com
File Name: ch16/01_cartpole_es.py
Class Name:
Method Name: train_step


Project Name: activatedgeek/LeNet-5
Commit Name: b9d7f39a752d23a7de60ea6d679812c401fab57e
Time: 2019-01-01
Author: 1sanyamkapoor@gmail.com
File Name: run.py
Class Name:
Method Name: train


Project Name: ncullen93/torchsample
Commit Name: f4ca9b361adb382423c753f7f864a5dd0e454964
Time: 2017-05-12
Author: ncullen.th@dartmouth.edu
File Name: torchsample/transforms/tensor_transforms.py
Class Name: ToVariable
Method Name: __call__