我想了解的进步在tf.nn.avg_pool,tf.nn.max_pool,tf.nn.conv2d说法.
该文件反复说
strides:长度> = 4的整数列表.输入张量的每个维度的滑动窗口的步幅.
我的问题是:
tf.reshape(_X,shape=[-1, 28, 28, 1]).为什么-1?遗憾的是,使用-1重新整形的文档中的示例并不能很好地转换为这种情况.
python convolution neural-network conv-neural-network tensorflow
我一直在使用TensorFlow中卷积网的这个例子进行编码,我对这种权重分配感到困惑:
weights = {
# 5x5 conv, 1 input, 32 outputs
'wc1': tf.Variable(tf.random_normal([5, 5, 1, 32])),
# 5x5 conv, 32 inputs, 64 outputs
'wc2': tf.Variable(tf.random_normal([5, 5, 32, 64])),
# fully connected, 7*7*64 inputs, 1024 outputs
'wd1': tf.Variable(tf.random_normal([7*7*64, 1024])),
# 1024 inputs, 10 outputs (class prediction)
'out': tf.Variable(tf.random_normal([1024, n_classes]))
}
Run Code Online (Sandbox Code Playgroud)
我们怎么知道'wd1'权重矩阵应该有7 x 7 x 64行?
它后来用于重塑第二个卷积层的输出:
# Fully connected layer
# Reshape conv2 output to fit dense layer input
dense1 = tf.reshape(conv2, [-1, _weights['wd1'].get_shape().as_list()[0]])
# Relu activation
dense1 = …Run Code Online (Sandbox Code Playgroud)