import tensorflow as tf

        message='Strides > 1 not supported.')

    # Convolution when number of indices is larger than zero.
    def _conv_nonzero():
        # Gather patches.
        p = tf.gather_nd(x_, blk_indices_)
        p_ = tf.reshape(p, [-1, ksize[0] * ksize[1] * ksize[2]])

        # Convolution on patches.
        w_ = tf.reshape(w, [ksize[0] * ksize[1] * ksize[2], -1])
        q = tf.matmul(p_, w_)

        # Center locations.
        blk_indices_crop = blk_indices[:, 0, 0, :]

        #  Project back to an image.
        y = tf.scatter_nd(blk_indices_crop, q, out_shape)
        return y
