4cdf99d4f8a25639ccf89a933a5cfc6553d657ad,onmt/translate/Beam.py,GNMTGlobalScorer,update_score,#GNMTGlobalScorer#Any#Any#,182

Before Change


        if "prev_penalty" in beam.global_state.keys():
            beam.scores.add_(beam.global_state["prev_penalty"])
            cov = beam.global_state["coverage"] + attn
            penalty = self.beta * (torch.max(cov, cov.clone().fill_(1.0)).sum(1) - cov.size(1))
            beam.scores.sub_(penalty)

    def update_global_state(self, beam):
        "Keeps the coverage vector as sum of attens"

After Change


        if "prev_penalty" in beam.global_state.keys():
            beam.scores.add_(beam.global_state["prev_penalty"])
            cov = beam.global_state["coverage"] + attn
            penalty = self.cov_penalty(beam,
                                       logprobs,
                                       beam.global_state["coverage"],
                                       self.beta)
            beam.global_state["prev_penalty"] = penalty
            beam.scores.sub_(penalty)

    def update_global_state(self, beam):
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: OpenNMT/OpenNMT-py
Commit Name: 4cdf99d4f8a25639ccf89a933a5cfc6553d657ad
Time: 2018-03-07
Author: s.gehrmann@outlook.com
File Name: onmt/translate/Beam.py
Class Name: GNMTGlobalScorer
Method Name: update_score


Project Name: chainer/chainercv
Commit Name: d37d08d9b2a806b3345fba41711c0d517b92a65c
Time: 2017-06-15
Author: yuyuniitani@gmail.com
File Name: chainercv/links/model/vgg/vgg16.py
Class Name: VGG16Layers
Method Name: predict


Project Name: NifTK/NiftyNet
Commit Name: a59350bf9cc20c9e02e2397d31bbf87848db8f9e
Time: 2017-10-19
Author: carole.sudre.12@ucl.ac.uk
File Name: niftynet/evaluation/region_properties.py
Class Name: RegionProperties
Method Name: glcm