【发布时间】:2018-07-10 18:12:21
【问题描述】:
为了学习tensorflow,我执行了这个tensorflow官方mnist脚本(cnn_mnist.py),并用tensorboard展示了图表。
以下是部分代码。 该网络包含两个卷积层和两个密集层。
conv1 = tf.layers.conv2d(inputs=input_layer,filters=32,kernel_size=[5, 5],
padding="same",activation=tf.nn.relu)
pool1 = tf.layers.max_pooling2d(inputs=conv1, pool_size=[2, 2], strides=2)
conv2 = tf.layers.conv2d(inputs=pool1,filters=64,kernel_size=[5, 5],
padding="same",activation=tf.nn.relu)
pool2 = tf.layers.max_pooling2d(inputs=conv2, pool_size=[2, 2], strides=2)
pool2_flat = tf.reshape(pool2, [-1, 7 * 7 * 64])
dense = tf.layers.dense(inputs=pool2_flat, units=1024, activation=tf.nn.relu)
dropout = tf.layers.dropout(
inputs=dense, rate=0.4, training=mode == tf.estimator.ModeKeys.TRAIN)
logits = tf.layers.dense(inputs=dropout, units=10)
但是看tensorboard生成的图,有3个conv层和3个dense层。
没想到会生成conv2d_1和dense_1。
为什么会生成conv2d_1 和dense_1?
【问题讨论】:
标签: python tensorflow deep-learning conv-neural-network tensorboard