tf.equal(x, y, name=None)
Returns the truth value of (x == y) element-wise.
Args:
x: ATensor. Must be one of the following types:float32,float64,int32,int64,complex64,quint8,qint8,qint32.y: ATensor. Must have the same type asx.name: A name for the operation (optional).
Returns:
A Tensor of type bool.
代码举例:
a = tf.constant([2,3])
b = tf.constant([3,4])
sess.run(tf.equal(a,b))
输出:
array([False, False], dtype=bool)
本文详细介绍了 TensorFlow 中的 tf.equal 函数,该函数用于比较两个张量是否相等,并返回布尔类型的张量结果。文中通过具体示例展示了如何使用此函数进行元素级别的比较。
1341

被折叠的 条评论
为什么被折叠?



