import tensorflow as tf

        # Reshape patches.
        p = tf.reshape(p, [blk_shape[0], blk_shape[1], blk_shape[2], -1])

        # Convolution on patches.
        q = tf.nn.conv2d(p, w, strides, 'VALID', use_cudnn_on_gpu=True)

        # Paste convolution results.
        q_shape = tf.shape(q)
