fdfdbec9e2f2eccfbdd331ae8d165d3ce05bcb73,fairseq/models/fairseq_model.py,BaseFairseqModel,get_normalized_probs,#BaseFairseqModel#Any#Any#Any#,46

Before Change


        if hasattr(self, "decoder"):
            return self.decoder.get_normalized_probs(net_output, log_probs, sample)
        elif torch.is_tensor(net_output):
            logits = net_output.float()
            if log_probs:
                return F.log_softmax(logits, dim=-1)
            else:
                return F.softmax(logits, dim=-1)
        raise NotImplementedError

After Change


        sample: Optional[Dict[str, Tensor]] = None,
    ):
        Get normalized probabilities (or log probs) from a net"s output.
        return self.get_normalized_probs_scriptable(net_output, log_probs, sample)

    // TorchScript doesn"t support super() method so that the scriptable Subclass
    // can"t access the base class model in Torchscript.
    // Current workaround is to add a helper function with different name and
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: pytorch/fairseq
Commit Name: fdfdbec9e2f2eccfbdd331ae8d165d3ce05bcb73
Time: 2020-02-26
Author: chenliu8@fb.com
File Name: fairseq/models/fairseq_model.py
Class Name: BaseFairseqModel
Method Name: get_normalized_probs


Project Name: pytorch/fairseq
Commit Name: 808b751597d85c098990080d21fd450877dcb242
Time: 2021-02-22
Author: miguel.delagua@nuance.com
File Name: fairseq/models/fairseq_decoder.py
Class Name: FairseqDecoder
Method Name: get_normalized_probs


Project Name: dpressel/mead-baseline
Commit Name: ea556a8f0d9fb0ba1a18b8ee3a08df198dbe418d
Time: 2018-11-13
Author: dpressel@gmail.com
File Name: python/baseline/tf/lm/model.py
Class Name: LanguageModelBase
Method Name: create_loss