美文网首页
tf.name_scope 与 tf.variable_scop

tf.name_scope 与 tf.variable_scop

作者: Amyfeelily | 来源:发表于2018-10-15 22:36 被阅读0次

tf.name_scope 对 tf.get_variable 与 tf.Variable 的影响

  • tf.Variable 会加上 name_scope 的名字前缀, tf.get_variable 不会(同时以为 tf.get_variable 没有加 name_scope 的前缀,所以是全局变量,不在 name_scope 中,也无法 get_variable 创建同样的 name 的变量)


    image.png

tf.variable_scope 对 tf.get_variable 与 tf.Variable 的影响

  • tf.Variable 会加上 variable_scope 的名字前缀,tf.Variable碰到相同的变量会自动加名字, tf.get_variable 也会(同时以为 tf.get_variable 加 variable_scope 的前缀,同一个variable_scope中,只可以创作一个 name 的 get_variable, 如果需要variable_scope中共享同一个 name 的get_variable,需要设置参数 reuse=True)


    image.png
image.png image.png image.png

相关文章

网友评论

      本文标题:tf.name_scope 与 tf.variable_scop

      本文链接:https://www.haomeiwen.com/subject/ciwqzftx.html