import tensorflow as tf

        x,
        indices.bin_counts,
        indices.active_block_indices,
        dynamic_bsize=block_params.bsize,
        dynamic_bstride=block_params.bstrides,
        dynamic_boffset=block_params.boffset,
        transpose=transpose)

    # Convolution on patches.
    if transpose:
        q = tf.nn.conv2d(p, w, strides, 'VALID', data_format='NCHW', use_cudnn_on_gpu=True)
    else:
        q = tf.nn.conv2d(p, w, strides, 'VALID', use_cudnn_on_gpu=True)

    # Allocate output tensor.
    if use_var:
        y = sbnet_module.sparse_scatter_var(
            q,
            indices.bin_counts,
            indices.active_block_indices,
