tf.assert_greater()如果x<=y就抛出异常,否则执行输出
参数:
tf.assert_greater(
x,
y,
data=None,
summarize=None,
message=None,
name=None
)
使用案例:
import tensorflow as tf
x = 1
y = 2
sess = tf.Session()
with tf.control_dependencies([tf.assert_greater(x, y)]):
output = tf.reduce_sum(x)
print(sess.run(output))