Machine learning 为什么TensorFlow在TensorBoard可视化中为我的变量创建额外的名称空间?

Machine learning 为什么TensorFlow在TensorBoard可视化中为我的变量创建额外的名称空间?,machine-learning,neural-network,tensorflow,conv-neural-network,tensorboard,Machine Learning,Neural Network,Tensorflow,Conv Neural Network,Tensorboard,我创建变量如下: x = tf.placeholder(tf.float32, shape=[None, D], name='x-input') # M x D # Variables Layer1 #std = 1.5*np.pi std = 0.1 W1 = tf.Variable( tf.truncated_normal([D,D1], mean=0.0, stddev=std, name='W1') ) # (D x D1) S1 = tf.Variable(tf.constant(10

我创建变量如下:

x = tf.placeholder(tf.float32, shape=[None, D], name='x-input') # M x D
# Variables Layer1
#std = 1.5*np.pi
std = 0.1
W1 = tf.Variable( tf.truncated_normal([D,D1], mean=0.0, stddev=std, name='W1') ) # (D x D1)
S1 = tf.Variable(tf.constant(100.0, shape=[1], name='S1')) # (1 x 1)
C1 = tf.Variable( tf.truncated_normal([D1,1], mean=0.0, stddev=0.1, name='C1') ) # (D1 x 1)
但由于某些原因,tensorflow在我的可视化中添加了额外的变量块:


它为什么这样做?我如何阻止它?

您在TF中使用的名称不正确

W1 = tf.Variable( tf.truncated_normal([D,D1], mean=0.0, stddev=std, name='W1') )
                  \----------------------------------------------------------/
                                           initializer 
     \-------------------------------------------------------------------------/
                                 actual variable
因此,您的代码创建未命名变量,并命名初始值设定项op
W1
。这就是为什么您在名为
W1
的图形中看到的不是您的
W1
,而是重命名的初始值设定项,而您的
W1
应该是
变量
(因为这是TF分配给未命名ops的默认名称)。应该是

W1 = tf.Variable( tf.truncated_normal([D,D1], mean=0.0, stddev=std), name='W1' )

它将为实际变量创建名为
W1
的节点,并将附加一个小的初始化节点(用于为随机值设定种子)。

您在TF中使用的名称不正确

W1 = tf.Variable( tf.truncated_normal([D,D1], mean=0.0, stddev=std, name='W1') )
                  \----------------------------------------------------------/
                                           initializer 
     \-------------------------------------------------------------------------/
                                 actual variable
因此,您的代码创建未命名变量,并命名初始值设定项op
W1
。这就是为什么您在名为
W1
的图形中看到的不是您的
W1
,而是重命名的初始值设定项,而您的
W1
应该是
变量
(因为这是TF分配给未命名ops的默认名称)。应该是

W1 = tf.Variable( tf.truncated_normal([D,D1], mean=0.0, stddev=std), name='W1' )
它将为实际变量创建名为
W1
的节点,并将附加一个小的初始化节点(用于为随机值设定种子)