Let’s say I have an array (final
) of shape (2048, 128)
. I have got another array called indices
of shape (2048, 1)
.
If I wanted to scatter a value of 1 in final
w.r.t indices
, how will I do that?
What I have tried:
indices = tf.constant(np.random.randint(1000, size=(2048, 1)))
output = tf.scatter_nd(indices, 1, [2048, 128])
Results into:
InvalidArgumentError: Updates shape must have rank at least one. Found:[] [Op:ScatterNd]
What is the recommended solution?