6f405851fcb3be013441810be9a7edbbc04fd2a3,niftynet/layer/loss_segmentation.py,LossFunction,layer_op,#LossFunction#Any#Any#Any#,46

Before Change


                    // performs softmax if required
                    if self._softmax:
                        pred_b = tf.cast(pred_b, dtype=tf.float32)
                        pred_b = tf.nn.softmax(pred_b)

                    // reshape pred, ground_truth, weight_map to the same
                    // size: (n_voxels, num_classes)
                    // if the ground_truth has only one channel, the shape
                    // becomes: (n_voxels,)
                    spatial_shape = pred_b.get_shape().as_list()[:-1]
                    ref_shape = spatial_shape + [-1]
                    ground_truth_b = tf.reshape(ground_truth[b_ind], ref_shape)
                    if ground_truth_b.get_shape().as_list()[-1] == 1:
                        ground_truth_b = tf.squeeze(ground_truth_b, axis=-1)
                    if weight_map is not None:
                        weight_b = tf.reshape(weight_map[b_ind], ref_shape)
                        if weight_b.get_shape().as_list()[-1] == 1:
                            weight_b = tf.squeeze(weight_b, axis=-1)
                    else:
                        weight_b = None

After Change


            batch_size = ground_truth.get_shape()[0].value
            ground_truth = tf.reshape(ground_truth, [batch_size, -1])
            if weight_map is not None:
                weight_map = tf.reshape(weight_map, [batch_size, -1])
            // assumes same gt and weight across scales

            // prediction should be a list for multi-scale losses
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 6

Instances


Project Name: NifTK/NiftyNet
Commit Name: 6f405851fcb3be013441810be9a7edbbc04fd2a3
Time: 2018-05-15
Author: d.shakir@ucl.ac.uk
File Name: niftynet/layer/loss_segmentation.py
Class Name: LossFunction
Method Name: layer_op


Project Name: NifTK/NiftyNet
Commit Name: 5b5ea7b5d864e53894f5342f19becfba8f8035e5
Time: 2017-12-18
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/network/interventional_dense_net.py
Class Name: INetDense
Method Name: layer_op


Project Name: deepmipt/DeepPavlov
Commit Name: d86360af087d51f5e2cb2f9e57ddc95207fc3cd4
Time: 2018-06-05
Author: yurakuratov@gmail.com
File Name: deeppavlov/core/layers/tf_layers.py
Class Name:
Method Name: cudnn_gru