tf.control_dependencies() and tf.while_loop()
tf.control_dependencies()设计是用来控制计算流图的,给图中的某些计算指定顺序。比如:我们想要获取参数更新后的值,那么我们可以这么组织我们的代码。
opt = tf.train.Optimizer().minize(loss)
with tf.control_dependencies([opt]):
updated_weight = tf.identity(wei...
转载
2018-08-21 15:17:49 ·
450 阅读 ·
0 评论