Unfortunately I don’t have the solution right now
But , I’ve tried to reproduce your snippet and it is not even deterministic: I get 2, 3 or 4 on axis 1 run 2 run.
What you get do here is (not clean, but works):
data = mx.nd.array([1,1,1,1])
index = mx.nd.array([1, 1,1])
add = mx.nd.array([1, 2,3])
indices = np.unique(index.asnumpy()).tolist()
new_add = [mx.nd.sum(mx.nd.where(index == idx, add, mx.nd.zeros_like(add))) for idx in indices]
add = mx.nd.concatenate(new_add)
index = mx.nd.array(indices)
data[index] += add
Note that we also miss a np.unique like op How to get unique values for a symbol?