special_fn.py 文件源码

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

项目:tefla 作者: openAGI 项目源码 文件源码
def underlying_variable(t):
    """Find the underlying tf.Variable object.

    Args:
      t: a Tensor

    Returns:
      a tf.Varaible object.
    """
    t = variable_ref(t)
    assert t is not None
    # make sure that the graph has a variable index and that it is up-to-date
    if not hasattr(tf.get_default_graph(), "var_index"):
        tf.get_default_graph().var_index = {}
    var_index = tf.get_default_graph().var_index
    for v in tf.global_variables()[len(var_index):]:
        var_index[v.name] = v
    return var_index[t.name]
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号