984d17836d7a6240942cd44f2f61c92a427bb9bb,niftynet/layer/crop.py,CropLayer,layer_op,#CropLayer#Any#,25

Before Change



    def layer_op(self, inputs):
        spatial_rank = layer_util.infer_spatial_rank(inputs)
        kernel_shape = np.hstack((
            [self.border * 2 + 1] * spatial_rank, 1, 1)).flatten()
        // initializer a kernel with all 0s, and set the central element to 1
        np_kernel = layer_util.trivial_kernel(kernel_shape)
        crop_kernel = tf.constant(np_kernel, dtype=inputs.dtype)
        // split channel dim
        output_tensor = [tf.expand_dims(x, -1)
                         for x in tf.unstack(inputs, axis=-1)]
        output_tensor = [tf.nn.convolution(input=inputs,

After Change


    def layer_op(self, inputs):
        spatial_rank = layer_util.infer_spatial_rank(inputs)
        offsets = [0, *([int(self.border)] * spatial_rank), 0]
        out_shape = [-1, *[int(d) - 2 * int(self.border) for d in list(inputs.shape)[1:-1]], -1]
        output_tensor = tf.slice(inputs, offsets, out_shape)
        return output_tensor
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: NifTK/NiftyNet
Commit Name: 984d17836d7a6240942cd44f2f61c92a427bb9bb
Time: 2018-04-24
Author: z.eaton-rosen@ucl.ac.uk
File Name: niftynet/layer/crop.py
Class Name: CropLayer
Method Name: layer_op


Project Name: NifTK/NiftyNet
Commit Name: f9f1242e23bc4ad0433577b81274b9a6065fbb89
Time: 2017-07-13
Author: eli.gibson@gmail.com
File Name: niftynet/utilities/misc_io.py
Class Name:
Method Name: match_volume_shape_to_patch_definition


Project Name: keras-team/keras
Commit Name: 45a10bc6d708fade197a37bfbc62312caf70e6a7
Time: 2017-02-17
Author: francois.chollet@gmail.com
File Name: keras/layers/convolutional_recurrent.py
Class Name: ConvLSTM2D
Method Name: get_constants