
image.png
目前網(wǎng)上在探討的 tf.name_scope 和 tf.variable_scope 區(qū)別時,著重研究他們對變量的作用,即:對 tf.Variable 和 tf.get_variable 命名的作用,已經(jīng)有很多帖子,此處不再探討。
此帖子專門實驗他們對操作option命名。如上圖所示:
可見無論是 op_1 還是 占位符 op_2, 這兩者與get_variable產(chǎn)生的兩個變量 a 和 b沒有任何聯(lián)系,但是他們的命名卻是:
Tensor("ns/vs/op1:0", shape=(), dtype=int32)
和
Tensor("ns/vs/ph1:0", dtype=float32)
結(jié)論1:tf.name_scope 和 tf.variable_scope 均會 影響 對 op 的命名。
再試試交換 vs 和 ns 命名域,結(jié)果有沒有變化:

image.png
結(jié)論2:op的命名沒變化,故兩者 依舊都會影響op的命名。