import tensorflow as tf

        dynamic_bsize=bsize,
        dynamic_bstride=bstride,
        dynamic_boffset=boffset)

    # return a list of gradients of output with respect to each input
    if not doAdd:
        # scatter blocks of zeroes over a base tensor of ones to compute a stamp-out gradient mask for dy_dybase
        stamp_out_blocks = sbnet_module.sparse_scatter(
            tf.zeros_like(blocksX),
            binCounts,
            activeBlockIndices,
            tf.ones_like(grad),
            dynamic_bsize=bsize,
            dynamic_bstride=bstride,
            dynamic_boffset=boffset,
            add=False)
        dy_dybase = grad * stamp_out_blocks
        return [dout_dx, None, None, dy_dybase, None, None, None]
    else:
        # d(x+ybase)/dybase = 1, so just pass back grad as dout_dybase
        return [dout_dx, None, None, grad, None, None, None]

