I want to change the value in tensor t to a where its value is b, which can be expressed in numpy as:
t[t == b] = a
I want to change the value in tensor t to a where its value is b, which can be expressed in numpy as:
t[t == b] = a
This creates a new tensor as specified:
t2 = tf.where( tf.equal( b, t ), a * tf.ones_like( t ), t )
If you want to change the value of t you can only do that if t is a variable, not a simple tensor, and then you can use assign:
tf.assign( t, t2 )