环境 Python_3.5.2 TensorFlow_1.2.1
import tensorflow as tf
v1 = tf.constant([1.0, 2.0, 3.0, 4.0])
v2 = tf.constant([4.0, 3.0, 2.0, 1.0])
sess = tf.InteractiveSession()
print(tf.greater(v1, v2).eval())
print(tf.where(tf.greater(v1, v2), v1, v2).eval())
sess.close()
Windows系统环境下应使用where()函数替换select()函数
若使用select()函数会报 AttributeError: module ‘tensorflow’ has no attribute ‘select’