tf.nn.conv2d()

由于我做的是图像处理方面的,所以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).

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值