私はTensorFlowのチュートリアルを読んでいて、
with tf.name_scope('read_inputs') as scope:
# something
例
a = tf.constant(5)
そして
with tf.name_scope('s1') as scope:
a = tf.constant(5)
同じ効果があるようです。では、なぜ を使用するのでしょうかname_scope
?
ベストアンサー1
それらは同じものではありません。
import tensorflow as tf
c1 = tf.constant(42)
with tf.name_scope('s1'):
c2 = tf.constant(42)
print(c1.name)
print(c2.name)
プリント
Const:0
s1/Const:0
名前が示すように、スコープ関数は、名前内部で作成するオペレーションの。これは、テンソルの参照方法、再利用、TensorBoard でのグラフの表示方法などに影響します。