张力板+tensorflow.slim公司一起工作

2024-06-16 14:15:39 发布

您现在位置:Python中文网/ 问答频道 /正文

在低级TensorFlowAPI上,我可以用下面的代码绘制一个直方图

.. some code ..
with tf.name_scope('output_layer'):
    weights = tf.Variable(tf.random_normal([d1, d2], dtype=tf.float32),
                          name='weights')
    biases = tf.Variable(tf.random_normal([d2], dtype=tf.float32), 
                         name='biases')

tf.summary.histogram('output_weights', weights)
tf.summary.histogram('biases', biases)

最近我决定试用slimAPI,我想知道如何在简单和更复杂的情况下管理TensorBoard图。在

例如,如果我想在下面两个例子中绘制权重的直方图(如tf.summary.histogram)和偏差的平均值(如tf.summary.scalar),我该怎么做?在

简单示例:

^{pr2}$

复杂示例:

with tf.name_scope('output_layer'):
    predictions = slim.stack(inputs, slim.fully_connected, [32, 64, 128])

Tags: namelayeroutputtfwith绘制randomsummary
1条回答
网友
1楼 · 发布于 2024-06-16 14:15:39

我认为标准的方法是建立一个这样的循环,它将为每个层添加权重、偏差、批次标准参数等的分布和直方图:

for variable in slim.get_model_variables():
    tf.summary.histogram(variable.op.name, variable)

相关问题 更多 >