tf.name_scope和tf.variable_scope对

2019-03-12  本文已影响0人  Dorts
image.png

目前网上在探讨的 tf.name_scope 和 tf.variable_scope 区别时,着重研究他们对变量的作用,即:对 tf.Variable 和 tf.get_variable 命名的作用,已经有很多帖子,此处不再探讨。

此帖子专门实验他们对操作option命名。如上图所示:
可见无论是 op_1 还是 占位符 op_2, 这两者与get_variable产生的两个变量 a 和 b没有任何联系,但是他们的命名却是:
Tensor("ns/vs/op1:0", shape=(), dtype=int32)

Tensor("ns/vs/ph1:0", dtype=float32)

结论1:tf.name_scope 和 tf.variable_scope 均会 影响 对 op 的命名。

再试试交换 vs 和 ns 命名域,结果有没有变化:


image.png

结论2:op的命名没变化,故两者 依旧都会影响op的命名。

上一篇 下一篇

猜你喜欢

热点阅读