import tensorflow as tf

    activeBlockIndices = op.inputs[2]
    bsize = op.inputs[3]
    bstride = op.inputs[4]
    boffset = op.inputs[5]
    transpose = op.get_attr("transpose")

    # if scatter is overlapping then gradient should still work
    # because we are overwriting the same values
    # compute dOutput/dx
    result = sbnet_module.sparse_scatter(
        grad,
        binCounts,
        activeBlockIndices,
        tf.zeros_like(x),    # output base tensor to add on top of
        dynamic_bsize=bsize,
        dynamic_bstride=bstride,
        dynamic_boffset=boffset,
        add=True,
        transpose=transpose,
        atomic=True)

    return [result, None, None, None, None, None]    # no gradients wrt indices or block params


@ops.RegisterGradient("SparseScatter")
def _sparse_scatter_grad(op, grad):
