[英]I got a error when I got the variables of convolution layers in tensorflow
I want to got variables of convolution layers and to visualize it. 我想获取卷积层的变量并将其可视化。 Then my code is
然后我的代码是
d3 = de_conv(d2, weights2['wc2'], biases2['bc2'], out_shape=[batch_size , c2, c2, 128])
d3 = batch_norm(d3, epsilon=1e-5, decay=0.9)
d3 = tf.nn.relu(d3)
tf.add_to_collection('weight_2', weights2['wc3'])
and in test 并在测试中
with tf.Session() as sess:
saver.restore(sess , model_path)
conv_weights = sess.run([tf.get_collection('weight_2')])
#visualize the weights
conv_weights = np.array(conv_weights)
print(conv_weights.shape)
vis_square(conv_weights)
But I don't understand the conv_weights have a confusing dimensions 但是我不明白conv_weights有一个令人困惑的维度
(1, 1, 5, 5, 1, 128)
转换层的权重应为[filter height, filter width, input channels, number of filters (output channels]
。除了前两个维之外,您的权重是合适的。是否仅包装在两个列表中?例如[[weights]]
只是weights
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.