441a175deaa5812c086cdb8a3939d51d39f5a7ae,nussl/deep/train/trainer.py,Trainer,setup_loss,#Trainer#Any#Any#,89

Before Change



    def setup_loss(self, loss_functions, output_target_map):
        self.output_target_map = output_target_map
        self.loss_dictionary = {
            target: (loss_functions[fn.upper()].value(), float(weight))
            for (fn, target, weight)
            in self.options["loss_function"]
        }
        self.loss_keys = sorted(list(self.loss_dictionary))

    @staticmethod
    def build_model(model):

After Change


        self.loss_dictionary = {}
        for (_fn, target, weights) in self.options["loss_function"]:
            if "PIT" in _fn.upper():
                loss_fn = _fn.split(":")[1]
                loss_fn = loss_functions[loss_fn.upper()].value()
                fn = loss_functions["PIT"].value(loss_fn)
            else:
                fn = loss_functions[_fn.upper()].value()
            self.loss_dictionary[target] = (fn, float(weights))
        self.loss_keys = sorted(list(self.loss_dictionary))

    @staticmethod
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: interactiveaudiolab/nussl
Commit Name: 441a175deaa5812c086cdb8a3939d51d39f5a7ae
Time: 2020-01-26
Author: prem@u.northwestern.edu
File Name: nussl/deep/train/trainer.py
Class Name: Trainer
Method Name: setup_loss


Project Name: hanxiao/bert-as-service
Commit Name: 624f5b31d0572da62f8a61f51d49a157717c9a51
Time: 2019-01-21
Author: hanhxiao@tencent.com
File Name: benchmark.py
Class Name:
Method Name:


Project Name: GoogleCloudPlatform/PerfKitBenchmarker
Commit Name: af1a91b5b709f81e13a8fa67988a408c69e83dc3
Time: 2015-05-15
Author: connormccoy@google.com
File Name: perfkitbenchmarker/packages/ycsb.py
Class Name:
Method Name: _ParseWorkload