TensorFlow中max pooling层各参数的意义

  官方教程中没有解释pooling层各参数的意义,找了很久终于找到,在tensorflow/python/ops/gen_nn_ops.py中有写:

def _max_pool(input, ksize, strides, padding, name=None):
  r"""Performs max pooling on the input.

  Args:
    input: A `Tensor` of type `float32`. 4-D input to pool over.
    ksize: A list of `ints` that has length `>= 4`.
      The size of the window for each dimension of the input tensor.
    strides: A list of `ints` that has length `>= 4`.
      The stride of the sliding window for each dimension of the
      input tensor.
    padding: A `string` from: `"SAME", "VALID"`.
      The type of padding algorithm to use.
    name: A name for the operation (optional).

  Returns:
    A `Tensor` of type `float32`. The max pooled output tensor.
  """
  return _op_def_lib.apply_op("MaxPool", input=input, ksize=ksize,
                              strides=strides, padding=padding, name=name)

  

  padding有两个参数,分别是‘SAME’和'VALID':

  1.SAME:pool后进行填充,使输出图片的大小与输入时相同

  2.VALID:不进行填充

 

参考:

  1.http://stackoverflow.com/questions/35298823/how-to-write-a-custom-pooling-layer-module-in-tensor-flow/35303470#35303470

  2.https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/util/padding.h

posted on 2016-02-20 17:51  松松的鞋带儿  阅读(3426)  评论(0编辑  收藏  举报