hughperkins:

doesnt exist, as far as I can


Thanks for your reply, but you ignore this line “t_b = 2 * (v_a.data)” in my code
Now I’m sure this way that I can’t get v_a.grad
so I want to know how to achieve my operation in the condition that can’t jump out of variable. It seems like scatter_nd in tensorflow.

indices = tf.constant([0,3])
updates = tf.constant([0.2,0.6])
scatter = tf.scatter_nd(indices, updates, shape=4)
print scatter
[0.2 , 0 , 0 , 0.6]
as you can see, the index in indices fill the corresponding value in updates.