除了tf.control_dependencies
作为上下文管理器(即与Python一起使用with
)之外,tf.group
和之间的区别是tf.control_dependencies
什么?
什么时候应该使用?
它tf.group
没有任何特定的操作顺序吗?我假设tf.group([op_1, op_2, op_3])
在列表的顺序中执行ops,但也许情况并非如此?docstring不指定行为.
如果你看一下graphdef,c=tf.group(a, b)
会产生与图相同的图形
with tf.control_dependencies([a, b]): c = tf.no_op()
运行操作没有特定的顺序,TensorFlow会尽快(即并行)尝试执行操作.