tf.nn.conv2d中stride对输出的影响
来源:互联网 发布:如何在淘宝上找客服 编辑:程序博客网 时间:2024/05/21 11:50
之前一直以为只要padding=’SAME’,那么卷积之后输出的尺寸就和输入相同。其实不是,就算是’SAME’,步长stride也会对输出产生影响的。因为平时我们的步长一般为1,所以对结果并没有什么影响,但是一旦步长不为1,输出尺寸将不再与输入相同。
import tensorflow as tfdata=tf.Variable(tf.random_normal([64,48,48,3]),dtype=tf.float32)weight=tf.Variable(tf.random_normal([5,5,3,64]),dtype=tf.float32)sess=tf.InteractiveSession()tf.global_variables_initializer().run()conv1=tf.nn.conv2d(data,weight,strides=[1,1,1,1],padding='SAME')conv2=tf.nn.conv2d(data,weight,strides=[1,2,2,1],padding='SAME')conv3=tf.nn.conv2d(data,weight,strides=[1,4,4,1],padding='SAME')print(conv1)print(conv2)print(conv3)
结果分别是:
Tensor("Conv2D_6:0", shape=(64, 48, 48, 64), dtype=float32)Tensor("Conv2D_7:0", shape=(64, 24, 24, 64), dtype=float32)Tensor("Conv2D_8:0", shape=(64, 12, 12, 64), dtype=float32)
可以看出,卷积时输出尺寸的大小和stride之间存在倍数关系。
阅读全文
0 0
- tf.nn.conv2d中stride对输出的影响
- tf.nn.conv2d 实例
- tf.nn.conv2d()
- tf.nn.conv2d理解
- tf.nn.conv2d
- TensorFlow tf.nn.conv2d
- tf.nn.conv2d()
- tf.nn.conv2d
- TensorFlow-tf.nn.conv2d 函数
- Tensorflow系列:tf.nn.conv2d
- tf.nn.conv2d函数讲解
- TensorFlow tf.nn.conv2d()介绍
- tf.nn.conv2d用法简介
- tf.contrib.slim.conv2d ()和tf.nn.conv2d()的使用区别
- 【TensorFlow】tf.nn.conv2d是怎样实现卷积的?
- 【TensorFlow】tf.nn.conv2d是怎样实现卷积的?
- 【TensorFlow】tf.nn.conv2d是怎样实现卷积的?
- TensorFlow--tf.nn.conv2d是怎样实现卷积的?
- c语言实现文件拷贝命令
- C#(.net)连接SQLite数据库[附驱动资源]
- 第四周之于石头哥+模式化
- 变量的解构赋值
- 欢迎使用CSDN-markdown编辑器
- tf.nn.conv2d中stride对输出的影响
- 使用基本servlet技术生产图片验证码
- 微信JS-SDK说明文档
- Centos下mysql数据库安装、创建数据库、utf8编码设置、外部访问授权、导入sql执行、开机启动(系列2)
- python
- 13.1 初识@Controller
- 直播技术相关
- Spring Boot,Spring Data JPA多数据源支持配置
- java中的四种引用介绍,强引用,软引用,弱引用,虚引用