import tensorflow as tf

        p = tf.gather_nd(x_, blk_indices_)

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

        # Convolution on patches.
