e70bdb2d089ae283781c45b8d97963823a984baa,ch10/00_pong_pg.py,,,#,51

Before Change


            grad_means = 0.0
            grad_vars = 0.0
            grad_count = 0
            for p in net.parameters():
                grad_max = max(grad_max, p.grad.abs().max().data.cpu().numpy()[0])
                grad_means += (p.grad ** 2).mean().sqrt().data.cpu().numpy()[0]
                grad_vars += torch.var(p.grad).data.cpu().numpy()[0]
                grad_count += 1

            writer.add_scalar("baseline", baseline, step_idx)
            writer.add_scalar("entropy", entropy_v.data.cpu().numpy()[0], step_idx)
            writer.add_scalar("batch_scales", np.mean(batch_scales), step_idx)
            writer.add_scalar("batch_scales_std", scale_std, step_idx)

After Change



            writer.add_scalar("grad_l2", np.sqrt(np.mean(np.square(grads))), step_idx)
            writer.add_scalar("grad_max", np.max(np.abs(grads)), step_idx)
            writer.add_scalar("grad_var", np.var(grads), step_idx)

            batch_states.clear()
            batch_actions.clear()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: PacktPublishing/Deep-Reinforcement-Learning-Hands-On
Commit Name: e70bdb2d089ae283781c45b8d97963823a984baa
Time: 2017-12-15
Author: max.lapan@gmail.com
File Name: ch10/00_pong_pg.py
Class Name:
Method Name:


Project Name: arviz-devs/arviz
Commit Name: 48afd8f2c4ee6f746769642ffac135f3caab3a65
Time: 2018-07-09
Author: aloctavodia@gmail.com
File Name: arviz/stats/stats.py
Class Name:
Method Name: r2_score


Project Name: apache/incubator-mxnet
Commit Name: 5b7a6d979b3bcf43416be25a6e47e0fd150daa54
Time: 2020-09-08
Author: bojian.zheng@mail.utoronto.ca
File Name: tests/python/gpu/test_profiler_gpu.py
Class Name:
Method Name: test_gpu_memory_profiler_gluon


Project Name: apache/incubator-tvm
Commit Name: 8508ec34f1a6f52736747708a4227bedeb4899ff
Time: 2020-09-04
Author: masahi129@gmail.com
File Name: tests/python/relay/test_op_level4.py
Class Name:
Method Name: test_where