ff7cef721f19014462088d9b6fea3b349dffe5c9,pytext/loss/loss.py,LabelSmoothedCrossEntropyLoss,__call__,#LabelSmoothedCrossEntropyLoss#Any#Any#Any#,513

Before Change


        else:
            // negative KL-div has an additional log(num_classes) term but ignored
            // here because it doesn"t contribute to optimization
            log_probs = F.log_softmax(logits, dim=1) if self.from_logits else logits
            label_smoothing_loss = -1 * log_probs.mean(dim=1)

        if reduce:

After Change


            // negative KL-div has an additional log(num_classes) term but ignored
            // here because it doesn"t contribute to optimization
            if self.source == SourceType.LOGITS:
                log_probs = F.log_softmax(logits, dim=1)
            elif self.source == SourceType.PROBS:
                log_probs = logits.log()
            else:
                log_probs = logits
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 6

Non-data size: 3

Instances


Project Name: facebookresearch/pytext
Commit Name: ff7cef721f19014462088d9b6fea3b349dffe5c9
Time: 2020-06-10
Author: jrandolph@fb.com
File Name: pytext/loss/loss.py
Class Name: LabelSmoothedCrossEntropyLoss
Method Name: __call__


Project Name: facebookresearch/pytext
Commit Name: 6f9d127d91b4ab400b4afe6376426eccaa6afbc4
Time: 2019-07-17
Author: chenyangyu@instagram.com
File Name: pytext/models/output_layers/lm_output_layer.py
Class Name: LMOutputLayer
Method Name: get_pred


Project Name: keon/seq2seq
Commit Name: 55268ace0817879ace07b73e223c3a6db79a3180
Time: 2017-12-06
Author: kwk236@gmail.com
File Name: model.py
Class Name: Decoder
Method Name: forward


Project Name: dpressel/mead-baseline
Commit Name: 45ba4bbdd47b51ee607a62b49a0cad1f0d9ff917
Time: 2019-05-21
Author: dpressel@gmail.com
File Name: python/baseline/tf/lm/model.py
Class Name: LanguageModelBase
Method Name: _create_loss


Project Name: pytorch/fairseq
Commit Name: f2ae57908bacff105bde22dad8fb6f6881251a9d
Time: 2020-03-26
Author: myleott@fb.com
File Name: fairseq/criterions/sentence_prediction.py
Class Name: SentencePredictionCriterion
Method Name: forward


Project Name: SPFlow/SPFlow
Commit Name: 99f6a9b9b366e20ebc300fc5be904308c17c484f
Time: 2020-04-01
Author: steven.lang.mz@gmail.com
File Name: src/spn/algorithms/layerwise/layers.py
Class Name: Sum
Method Name: forward