41ca64cb4b975a83df082e5d8be7da85b1a15ba1,mmcv/runner/hooks/optimizer.py,OptimizerHook,after_train_iter,#OptimizerHook#Any#,19
Before Change
runner.optimizer.zero_grad()
runner.outputs["loss"].backward()
if self.grad_clip is not None:
self.clip_grads(runner.model.parameters())
runner.optimizer.step()
After Change
runner.optimizer.zero_grad()
runner.outputs["loss"].backward()
if self.grad_clip is not None:
grad_norm = self.clip_grads(runner.model.parameters())
if grad_norm is not None:
// Add grad norm to the logger
runner.log_buffer.update({"grad_norm": grad_norm},
runner.outputs["num_samples"])
runner.optimizer.step()
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 10
Instances Project Name: open-mmlab/mmcv
Commit Name: 41ca64cb4b975a83df082e5d8be7da85b1a15ba1
Time: 2020-06-08
Author: wangxinjiang@sensetime.com
File Name: mmcv/runner/hooks/optimizer.py
Class Name: OptimizerHook
Method Name: after_train_iter
Project Name: open-mmlab/mmcv
Commit Name: d5241b70871c0664a1584989b58d7c507c240278
Time: 2020-12-09
Author: 40779233+ZwwWayne@users.noreply.github.com
File Name: mmcv/runner/hooks/optimizer.py
Class Name: Fp16OptimizerHook
Method Name: after_train_iter
Project Name: open-mmlab/mmcv
Commit Name: 34127b9f145932a63905902e8fcd3b645f2d61b4
Time: 2020-09-26
Author: 40779233+ZwwWayne@users.noreply.github.com
File Name: mmcv/runner/hooks/optimizer.py
Class Name: Fp16OptimizerHook
Method Name: after_train_iter