tf_util.py 文件源码

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

项目:distributional_perspective_on_RL 作者: Kiwoo 项目源码 文件源码
def scope_vars(scope, trainable_only=False):
    """
    Get variables inside a scope
    The scope can be specified as a string

    Parameters
    ----------
    scope: str or VariableScope
        scope in which the variables reside.
    trainable_only: bool
        whether or not to return only the variables that were marked as trainable.

    Returns
    -------
    vars: [tf.Variable]
        list of variables in `scope`.
    """
    return tf.get_collection(
        tf.GraphKeys.TRAINABLE_VARIABLES if trainable_only else tf.GraphKeys.GLOBAL_VARIABLES,
        scope=scope if isinstance(scope, str) else scope.name
    )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号