tf.assert_none_equal()

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/fyq201749/article/details/82191443

tf.assert_none_equal()x和y中的元素如果有相等的就抛出异常
参数:

tf.assert_none_equal(
    x,
    y,
    data=None,
    summarize=None,
    message=None,
    name=None
)

使用案例:

import tensorflow as tf
x = [1, 2]
y = [4, 3]
sess = tf.Session()
with tf.control_dependencies([tf.assert_none_equal(x, y)]):
  output = tf.reduce_sum(x)
  print(sess.run(output))

猜你喜欢

转载自blog.csdn.net/fyq201749/article/details/82191443