当前位置:  开发笔记 > 编程语言 > 正文

tf.group和tf.control_dependencies有什么区别?

如何解决《tf.group和tf.control_dependencies有什么区别?》经验,为你挑选了1个好方法。

除了tf.control_dependencies作为上下文管理器(即与Python一起使用with)之外,tf.group和之间的区别是tf.control_dependencies什么?

什么时候应该使用?

tf.group没有任何特定的操作顺序吗?我假设tf.group([op_1, op_2, op_3])在列表的顺序中执行ops,但也许情况并非如此?docstring不指定行为.



1> Yaroslav Bul..:

如果你看一下graphdef,c=tf.group(a, b)会产生与图相同的图形

with tf.control_dependencies([a, b]):
    c = tf.no_op() 

运行操作没有特定的顺序,TensorFlow会尽快(即并行)尝试执行操作.

推荐阅读
吻过彩虹的脸_378
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有