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

本文通过实例详细解析了TensorFlow中Slim库的max_pool2D函数使用方法,包括输入参数、输出图像大小计算及代码运行结果展示,是理解并运用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-v2.15

TensorFlow-v2.15

TensorFlow

TensorFlow 是由Google Brain 团队开发的开源机器学习框架,广泛应用于深度学习研究和生产环境。 它提供了一个灵活的平台,用于构建和训练各种机器学习模型

评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值