官方教程中没有解释pooling层各参数的意义,找了好久终于找到,在tensorflow/python/ops/gen_nn_ops.py中有写:python
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':app
1.SAME:pool后进行填充,使输出图片的大小与输入时相同ide
2.VALID:不进行填充google
参考:spa
1.http://stackoverflow.com/questions/35298823/how-to-write-a-custom-pooling-layer-module-in-tensor-flow/35303470#35303470code
2.https://tensorflow.googlesource.com/tensorflow/+/master/tensorflow/core/util/padding.horm