620ce4bd12b6379b0b2c184aa8f2f2e066cbe48a,pytext/optimizer/fp16_optimizer.py,DynamicLossScaler,check_overflow,#DynamicLossScaler#Any#,90

Before Change


        self.is_overflow = False
        for p in generate_params(master_params):
            if p.grad is not None:
                cpu_sum = float(p.grad.float().sum())
                if (
                    cpu_sum == float("inf")
                    or cpu_sum == -float("inf")

After Change


        self.is_overflow = False
        for p in generate_params(params):
            self.check_overflow_(p.grad)
            if self.is_overflow:
                break

    def update_scale(self):
        rAccording to overflow situation, adjust loss scale.

        Once overflow happened, we decrease the scale by scale_factor.
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 4

Non-data size: 3

Instances


Project Name: facebookresearch/pytext
Commit Name: 620ce4bd12b6379b0b2c184aa8f2f2e066cbe48a
Time: 2019-08-11
Author: yuqingl@fb.com
File Name: pytext/optimizer/fp16_optimizer.py
Class Name: DynamicLossScaler
Method Name: check_overflow


Project Name: kengz/SLM-Lab
Commit Name: d670e94d3f8e938858e938b1d3efeac5389a26d3
Time: 2017-12-17
Author: lgraesser@users.noreply.github.com
File Name: slm_lab/experiment/control.py
Class Name: Session
Method Name: run_episode


Project Name: geek-ai/MAgent
Commit Name: d15a15df582f43d9bc65a434db0d64c9e276b724
Time: 2017-11-23
Author: zhenglianmin96@163.com
File Name: examples/api_demo.py
Class Name:
Method Name:


Project Name: deeptools/HiCExplorer
Commit Name: b73db6a46ed0e31cf85bde472dcd7d41b274f750
Time: 2017-12-19
Author: fidel.ramirez@gmail.com
File Name: hicexplorer/hicBuildMatrix.py
Class Name:
Method Name: get_correct_map