control.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:tensorflow-extenteten 作者: raviqqe 项目源码 文件源码
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))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号