tf.nn.conv2d

这个函数的功能是:给定4维的input和filter,计算出一个2维的卷积结果。函数的定义为:

def conv2d(input, filter, strides, padding, use_cudnn_on_gpu=None,
           data_format=None, name=None):

input:待卷积的数据。格式要求为一个张量,[batch, in_height, in_width, in_channels]. 
分别表示 批次数,图像高度,宽度,输入通道数。 
filter: 卷积核。格式要求为[filter_height, filter_width, in_channels, out_channels]. 
分别表示 卷积核的高度,宽度,输入通道数,输出通道数。 
strides :一个长为4的list. 表示每次卷积以后卷积窗口在input中滑动的距离 
padding :有SAME和VALID两种选项,表示是否要保留图像边上那一圈不完全卷积的部分。如果是SAME,则保留 
use_cudnn_on_gpu :是否使用cudnn加速。默认是True

tf.nn.max_pool 

进行最大值池化操作,而avg_pool 则进行平均值池化操作.函数的定义为:

def max_pool(value, ksize, strides, padding, data_format="NHWC", name=None):

value: 一个4D张量,格式为[batch, height, width, channels],与conv2d中input格式一样 
ksize: 长为4的list,表示池化窗口的尺寸 
strides: 池化窗口的滑动值,与conv2d中的一样 
padding: 与conv2d中用法一样。

相关文章:

  • 2021-10-23
  • 2021-10-09
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-12-26
  • 2021-10-26
  • 2021-08-31
猜你喜欢
  • 2021-06-19
  • 2021-08-27
  • 2021-09-14
  • 2021-10-17
  • 2021-11-13
  • 2021-08-03
  • 2021-07-22
相关资源
相似解决方案