TensorFlow基础笔记(11) max_pool2D函数 深度学习

复制代码
# def max_pool2d(inputs,
#                kernel_size,
#                stride=2,
#                padding='VALID',
#                data_format=DATA_FORMAT_NHWC,
#                outputs_collections=None,
#                scope=None):

#"VALID"模式下
#输出图像大小 out_height = round((in_height - floor(filter_height / 2) * 2) / strides_height) floor表示下取整 round表示四舍五入

input = tf.Variable(tf.round(10 * tf.random_normal([1, 7, 7, 1])))
#filter = tf.Variable(tf.round(5 * tf.random_normal([3, 3, 1, 1])))
#op2 = tf.nn.conv2d(input, filter, strides=[1, 1, 1, 1], padding=‘VALID’)
slim_max_pool2d = slim.max_pool2d(input, [3, 3], [1, 1], scope=‘pool1’)
#slim_conv2d_SAME = slim.conv2d(input, 1, [3, 3], [1, 1], weights_initializer=tf.ones_initializer, padding=‘SAME’)
with tf.Session() as sess:
sess.run(tf.global_variables_initializer())
slim_max_pool2d_value =
sess.run(slim_max_pool2d)
print(slim_max_pool2d_value.shape)

复制代码
![在这里插入图片描述](https://img-blog.csdnimg.cn/20200227165904459.jpg)

你可能感兴趣的:(TensorFlow基础笔记(11) max_pool2D函数 深度学习)