tf.control_dependencies
2019-08-29 23:41
2511 查看
tf.control_dependencies()是用来控制计算流图的,给图中的某些节点指定计算的顺序。
原型:
tf.control_dependencies(self, control_inputs)
该函数接受的参数control_inputs,是Operation或者Tensor构成的list。
例子:确保获得更新后的参数:
opt = tf.train.Optimizer().minize(loss)
with tf.control_dependencies([opt]): #先执行opt
updated_weight = tf.identity(weight) #再执行该操作
with tf.Session() as sess:
tf.global_variables_initializer().run()
sess.run(updated_weight, feed_dict={...}) # 这样每次得到的都是更新后的weight
相关文章推荐
- tf.control_dependencies()和tf.identity()
- tensorflow API:tf.control_dependencies
- (Tensorflow之十)tf.control_dependencies()用法
- Tensorflow 解惑[一]:关于tf.identity 和tf.control_dependencies
- tf.control_dependencies()
- tf.control_dependencies()作用及用法
- tf.control_dependencies与tf.identity组合详解
- tf.identity 和 tf.control_dependencies的用法
- TensorFlow入门基础知识(七)tf.control_dependencies的用法
- tf.control_dependencies()
- tf.control_dependencies()作用及用法
- tensorflow control_dependencies(self, control_inputs)以及identity(input, name=None)
- TensorFlow流程控制函数:tf.group tf.control_dependencies
- Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. The parameter is incorrect.
- Could not load file or assembly ‘AjaxControlToolkit’ or one of its dependencies. The parameter is incorrect. (Exception
- CruiseControl Enterprise 最佳实践 (2) : Keep your dependencies to yourself
- AngularJS form $addControl 注册控件control
- tf.train.Saver函数的用法之保存全部变量和模型
- TensorFlow 学习(一)—— tf get variable vs tf Variable ,tf nam
- SceneControl+AE+鼠标滚轮缩放