tf.nn.conv2d(input,filter,strides,padding,use_cudnn_on_gpu=None, name=None)
1 input 是一个4维度张量,tensor,数据类型为float32和float64其中之一,格式 [batch_size,input-height,input-width,input-chanells],含义[一批中有batch-size张图片, 每张图片高度为in_height, 每张图片宽度为in_width, 图像通道为in_channels]
2 filter 是滤波器,也是一个tensor,格式[filter-height,filter-width,inuput-chaneels,output-chaneels],含义是[滤波器的长度,滤波器的宽度,滤波器的输入图像的深度(也就是上个input输入图片的深度),输出图像的深度feature map的深度]
3 strides是步长,一维向量,格式 [batch,input-height,input-width,input-chanells] 什么意思呢,就是strides参数是对应input参数的四个维度的, 假设strides=[1,2,3,4] (实际上不能出现这样的参数),那么意思就是,在batch这个维度的步长是1,在input-height这个维度的步长是2,在input-width这个维度的步长是3,在input-chanells这个维度的步长是4. 我们通常把 batch 和 input_channels (strides 序列中的第一个第四个)的 stride 设为 1。这样才符合现实意义
4 padding 就是填充,分为"VALID" 和 "SAME"这两个字符型,就是滤波器在图像边缘的时候,两种不同操作方式,分别称之为有效填充VALID padding, 和相同填充same padding
5 use_cudnn_on_gpu=None 是否使用cudnn加速 默认使用 True bool型数据
6 name 是指tf.nn.conv2d这个函数输出的张量tensor的名字
网友评论