Brm*_*ßio 19 python tensorflow
我想举个例子来说明函数的用法tf.control_dependencies.例如,我要创建两个张量X和Y和它们是否相等或做一些印刷.
import tensorflow as tf
session = tf.Session()
X = tf.constant(5)
Y = tf.constant(50)
with tf.control_dependencies([tf.assert_equal(X, Y)]):
print('X and Y are equal!')
Run Code Online (Sandbox Code Playgroud)
在上面的代码中,X显然不等于Y.tf.control_dependencies在这种情况下做什么?
| 归档时间: |
|
| 查看次数: |
13831 次 |
| 最近记录: |