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

Before Change


            [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,
                                           filter=crop_kernel,
                                           strides=[1] * spatial_rank,
                                           padding="VALID",
                                           name="conv")
                         for inputs in output_tensor]
        output_tensor = tf.concat(output_tensor, axis=-1)
        return output_tensor

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: 10

Non-data size: 6

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: keras-team/keras
Commit Name: 55447cbb3d33c2c209fdad8a1d53a166bc39544e
Time: 2016-08-09
Author: farizrahman4u@gmail.com
File Name: keras/backend/theano_backend.py
Class Name:
Method Name: squeeze


Project Name: NifTK/NiftyNet
Commit Name: 2345eb88f3264da85643a4d9d5adec3cf6f9b973
Time: 2017-11-14
Author: wenqi.li@ucl.ac.uk
File Name: niftynet/utilities/filename_matching.py
Class Name: KeywordsMatching
Method Name: __extract_subject_id_from


Project Name: GPflow/GPflow
Commit Name: 30120a183c81cc5d18af0a00ae35e3ec9e06063a
Time: 2017-11-25
Author: art.art.v@gmail.com
File Name: gpflow/misc.py
Class Name:
Method Name: initialize_variables


Project Name: GPflow/GPflow
Commit Name: 601aee254c46a69c4d27e8bd8dea03021b40d961
Time: 2017-11-10
Author: art.art.v@gmail.com
File Name: gpflow/training/tensorflow_optimizer.py
Class Name: _TensorFlowOptimizer
Method Name: _initialize_optimizer


Project Name: ray-project/ray
Commit Name: 62c7ab518214286a4721dd7410978effd6d05471
Time: 2020-11-12
Author: sven@anyscale.io
File Name: rllib/execution/train_ops.py
Class Name: TrainTFMultiGPU
Method Name: __call__


Project Name: Picovoice/porcupine
Commit Name: d325d98d0b15eec035fa8462078eacfd38807fc8
Time: 2019-05-15
Author: alireza@picovoice.ai
File Name: binding/python/test_porcupine.py
Class Name: PorcupineTestCase
Method Name: test_process_multiple


Project Name: hanxiao/bert-as-service
Commit Name: 5abe8b315fd6cd79594f401626a03bf137507b99
Time: 2019-01-30
Author: hanhxiao@tencent.com
File Name: server/bert_serving/server/__init__.py
Class Name: BertSink
Method Name: _run


Project Name: uber/ludwig
Commit Name: ca98f96d527a03a7d7d76377eff44e1591d93ebe
Time: 2020-05-04
Author: jimthompson5802@gmail.com
File Name: ludwig/models/modules/combiners.py
Class Name: ConcatCombiner
Method Name: call


Project Name: Picovoice/porcupine
Commit Name: bb900faca99e91a5466604462bd9979ee02b9d47
Time: 2019-10-09
Author: alireza@picovoice.ai
File Name: demo/python/porcupine_demo.py
Class Name: PorcupineDemo
Method Name: run