f360de0fa4454122d665b9c32f4d5911a4ebec0c,niftynet/layer/loss.py,LossFunction,layer_op,#LossFunction#Any#Any#Any#Any#,32

Before Change


            if self._num_classes > 0:
                pred = tf.reshape(pred, [-1, self._num_classes])
            label = tf.reshape(label, [-1])
            if self._loss_func_params:
                data_loss = self._data_loss_func(pred,
                                                 label,
                                                 **self._loss_func_params)
            else:
                list_prediction.append(
                    tf.reshape(prediction, [-1, self._num_classes]))
            if weight_map is not None:
                weight_map = tf.reshape(weight_map, [-1])

            data_loss = 0

After Change


            if weight_map is not None:
                weight_map = tf.reshape(weight_map, [-1])

            data_loss = []
            for pred in prediction:
                if self._loss_func_params:
                    data_loss.append(self._data_loss_func(
                        pred, ground_truth, weight_map,
                        **self._loss_func_params))
                else:
                    data_loss.append(self._data_loss_func(
                        pred, ground_truth, weight_map))
            return tf.reduce_mean(data_loss)


def generalised_dice_loss(prediction,
                          ground_truth,
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 4

Instances


Project Name: NifTK/NiftyNet
Commit Name: f360de0fa4454122d665b9c32f4d5911a4ebec0c
Time: 2017-08-19
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/layer/loss.py
Class Name: LossFunction
Method Name: layer_op


Project Name: asyml/texar
Commit Name: f55217e5fee88bc38e58e62e886f79e561c4d069
Time: 2018-08-14
Author: zhitinghu@gmail.com
File Name: texar/losses/losses_utils.py
Class Name:
Method Name: reduce_batch_time


Project Name: NVIDIA/OpenSeq2Seq
Commit Name: 44ae6129731ee1d225db8a5f1bafea5fd4b9b542
Time: 2019-02-06
Author: boris.ginsburg@gmail.com
File Name: open_seq2seq/parts/transformer/common.py
Class Name: LayerNormalization
Method Name: call