官方教程中沒有解釋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