49e58fcd4fcbc3b596a1fced1f74b9a63464f0e8,parlai/core/torch_classifier_agent.py,TorchClassifierAgent,build_criterion,#TorchClassifierAgent#,156

Before Change



    def build_criterion(self):
        weight_tensor = torch.FloatTensor(self.class_weights)
        self.criterion = torch.nn.CrossEntropyLoss(weight_tensor)

    def share(self):
        Share model parameters.
        shared = super().share()

After Change



    def build_criterion(self):
        weight_tensor = torch.FloatTensor(self.class_weights)
        return torch.nn.CrossEntropyLoss(weight_tensor)

    def share(self):
        Share model parameters.
        shared = super().share()
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: facebookresearch/ParlAI
Commit Name: 49e58fcd4fcbc3b596a1fced1f74b9a63464f0e8
Time: 2019-08-12
Author: ahm@fb.com
File Name: parlai/core/torch_classifier_agent.py
Class Name: TorchClassifierAgent
Method Name: build_criterion


Project Name: facebookresearch/ParlAI
Commit Name: 49e58fcd4fcbc3b596a1fced1f74b9a63464f0e8
Time: 2019-08-12
Author: ahm@fb.com
File Name: parlai/core/torch_ranker_agent.py
Class Name: TorchRankerAgent
Method Name: build_criterion


Project Name: facebookresearch/ParlAI
Commit Name: 49e58fcd4fcbc3b596a1fced1f74b9a63464f0e8
Time: 2019-08-12
Author: ahm@fb.com
File Name: parlai/agents/seq2seq/seq2seq.py
Class Name: Seq2seqAgent
Method Name: build_criterion