【问题标题】:Why does TensorFlow create extra name spaces for my variables in the TensorBoard visualization?为什么 TensorFlow 会在 TensorBoard 可视化中为我的变量创建额外的命名空间?
【发布时间】:2016-10-26 08:20:59
【问题描述】:

我创建变量如下:

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 在我的可视化中添加了额外的变量块:

为什么会这样,我该如何阻止它?

【问题讨论】:

    标签: machine-learning neural-network tensorflow conv-neural-network tensorboard


    【解决方案1】:

    你在 TF 中错误地使用了名字

    W1 = tf.Variable( tf.truncated_normal([D,D1], mean=0.0, stddev=std, name='W1') )
                      \----------------------------------------------------------/
                                               initializer 
         \-------------------------------------------------------------------------/
                                     actual variable
    

    因此,您的代码会创建 未命名变量,并命名初始化操作 W1。这就是为什么您在名为W1 的图中看到的不是您的W1,而是重命名的初始化程序,而您的W1 应该是Variable(因为这是默认设置)名称 TF 分配给未命名的操作)。应该是

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

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

    【讨论】:

      猜你喜欢
      • 2016-05-30
      • 1970-01-01
      • 2011-01-01
      • 2021-09-23
      • 2021-07-18
      • 1970-01-01
      • 2019-08-25
      • 2017-12-27
      • 1970-01-01
      相关资源
      最近更新 更多