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

Before Change


            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)

After Change


            writer.add_scalar("loss_total", loss_v.data.cpu().numpy()[0], step_idx)

            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()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

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: mapbox/robosat
Commit Name: 9a8d91022cfde0a380d8700be76d6ddbd716a2af
Time: 2018-09-12
Author: o@courtin.co
File Name: robosat/tools/train.py
Class Name:
Method Name: train


Project Name: mapbox/robosat
Commit Name: 9a8d91022cfde0a380d8700be76d6ddbd716a2af
Time: 2018-09-12
Author: o@courtin.co
File Name: robosat/tools/train.py
Class Name:
Method Name: validate