tensorflow function笔记: tf.nn.conv2d

tf.nn.conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)

Arguments

input shape: [batch, in_height, in_width, in_channels]

filter shape: [filter_height, filter_width, in_channels, out_channels]

stride: Must have strides[0] = strides[3] = 1. For the most common case of the same horizontal and vertices strides, strides = [1, stride, stride, 1].

padding: A string from: “SAME“, “VALID“. The type of padding algorithm to use.

注意:

Input shape 和 filter shape 不同, input shape是普通图片数据集的四个维度,分别是 batch height width 和channel。

Filter shape 是 height, width, input channel, output channel。 filter 改变channel, 而不会改变batch size。 filter 和 stride 一起改变了height 和 width。

stride 的 batch (stride[0]) 和 channel (stride[3]) 都是1, height 和 width相等。

padding的方法有两种:

1、如果padding = ‘VALID’

new_height = new_width = (W – F + 1) / S (结果向上取整)
VALID方式不会在原有输入上加padding

2、如果padding = ‘SAME’

new_height = new_width = W / S (结果向上取整)
最常见的如果stride = [1 , 1, 1, 1] 图片会加padding使得输入与输出的height width 不变

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值