tf.where的使用
tf.where(condition, y_true, y_false)
该函数condition和y_true,y_false的shape需要相同
例如:condition = [true, false, true, false]
y_true = [1,2,3,4]
y_false = [-1,-2,-3,-5]
tf.where(condition, y_true, y_false)的结果为[1,-2,3,4]
tf.where(condition, y_true, y_false)
该函数condition和y_true,y_false的shape需要相同
例如:condition = [true, false, true, false]
y_true = [1,2,3,4]
y_false = [-1,-2,-3,-5]
tf.where(condition, y_true, y_false)的结果为[1,-2,3,4]