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


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM