由于我做的是图像处理方面的,所以2d卷积用得最频繁,为了防止在使用中出错,节省调试时间,有必要好好的看看官方文档,欲利其事,必先利其器。
format:conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None, data_format=None, name=None)
Args:
input: A `Tensor`. Must be one of the following types: `half`, `float32`, `float64`.(注意,这里输入不能是int之类的,只能是指定的这几种数据类型,话说half是什么数据类型。)
filter: A `Tensor`. Must have the same type as `input`. a filter / kernel tensor of shape `[filter_height, filter_width, in_channels, out_channels]`(必须与input是相同的数据类 型,这点也是必须注意的。还有filter要遵循这样的形式[filter_height, filter_width, in_channels, out_channels],其中输入通道in_channels要和input的C相同)
strides: A list of `ints`.
1-D of length 4. The stride of the sliding window for each dimension
of `input`. Must be in the same order as the dimension specified with format.(这里stride是个list,而且还要注意一般都是[1,stride_h,stride_w,1],stride[0]=stride[1]=1)
padding: A `string` from: `"SAME", "VALID"`.
The type of padding algorithm to use.(在这个padding模式下,一般本人用到的是SAME模式比较多,这样卷积之后的图片和卷积之前大小一样0.0)
use_cudnn_on_gpu: An optional `bool`. Defaults to `True`.(一般可以不管,但是如果用cpu进行计算的话,估计还是要显示的改成False,不然有可能出错)
data_format: An optional `string` from: `"NHWC", "NCHW"`. Defaults to `"NHWC"`. Specify the data format of the input and output data. With the default format "NHWC", the data is stored in the order of:[batch, in_height, in_width, in_channels] Alternatively, the format could be "NCHW", the data storage order of: [batch, in_channels, in_height, in_width].(指定输入input和返回值的数据形式,一般默认的是NHWC,也就是分别代表,N数量,H图片高,W图片宽,图像通道数)
name: A name for the operation (optional).