def with_dependencies(dependencies, tensor):
"""
This function is documented partially in tensorflow.org.
But, it cannot be found in a library.
"""
with tf.control_dependencies(dependencies):
if isinstance(tensor, tf.Tensor):
return tf.identity(tensor)
elif isinstance(tensor, tf.Operation):
return tf.group(tensor)
raise ValueError("{} must be tf.Tensor or tf.Operation."
.format(tensor))
评论列表
文章目录