b9927f30cb9c92040c30d0fe8c735d8baea167b2,tensornets/layers.py,,gconvbn,#,59

Before Change


        c = args[-1]
        f = x.shape[-1].value // c
        g = f // c
        x = tf.reshape(x, tf.concat([tf.shape(x)[:-1],
                                     tf.constant([g, c, c])], axis=0))
        x = tf.reduce_sum(x, axis=-2)
        x = reshape(x, tf.concat([tf.shape(x)[:-2],
                                  tf.constant([f])], axis=0), name="gconv")
        return batch_norm(x)

After Change


        f = x.shape[-1].value // c
        g = f // c
        kernel = np.zeros((1, 1, f * c, f), np.float32)
        for i in range(f):
            start = (i // c) * c * c + i % c
            end = start + c * c
            kernel[:, :, start:end:c, i] = 1.
        x = conv2d_primitive(x, tf.constant(kernel), strides=[1, 1, 1, 1],
                             padding="VALID", name="gconv")
        return batch_norm(x)
Italian Trulli
In pattern: SUPERPATTERN

Frequency: 3

Non-data size: 5

Instances


Project Name: taehoonlee/tensornets
Commit Name: b9927f30cb9c92040c30d0fe8c735d8baea167b2
Time: 2019-03-13
Author: me@taehoonlee.com
File Name: tensornets/layers.py
Class Name:
Method Name: gconvbn


Project Name: tensorflow/tpu
Commit Name: b6437e4dd115c5b290eb84b0620610b497293609
Time: 2020-05-12
Author: pengchong@google.com
File Name: models/official/detection/serving/inputs.py
Class Name:
Method Name: raw_image_tensor_input


Project Name: XifengGuo/CapsNet-Keras
Commit Name: 80dd4096ed186e706775adbe3663b46d719efdb0
Time: 2017-10-31
Author: guoxifeng1990@163.com
File Name: capsulelayers.py
Class Name: CapsuleLayer
Method Name: call