參考自tf2.1
官方文檔:
https://www.tensorflow.org/api_docs/python/tf/nn/max_pool2d
Performs the max pooling on the input.
用於在輸入中進行max pooling操作
tf.nn.max_pool2d(
input, ksize, strides, padding, data_format='NHWC', name=None
)
Args:
- input: A 4-D Tensor of the format specified by data_format.
- input: 由
data_format
指定的4D張量 - ksize: An int or list of ints that has length 1, 2 or 4. The size of the window for each dimension of the input tensor.
- ksize: 一個整數或者長度爲1,2或4的整型列表。指定輸入張量每個維度的窗口大小。
- strides: An int or list of ints that has length 1, 2 or 4. The stride of the sliding window for each dimension of the input tensor.
- strides: 一個整數或者長度爲1,2或4的整型列表。指定輸入張量每個維度的移動的步長
- padding: A string, either ‘VALID’ or ‘SAME’. The padding algorithm. See the “returns” section of tf.nn.convolution for details.
- padding: 一個字符串,可以是
'VALID'
或者是SAME
。 - data_format: A string. ‘NHWC’, ‘NCHW’ and ‘NCHW_VECT_C’ are supported.
- data_format: 一個字符串,支持
'NHWC'
,'NCHW'
和'NCHW_VECT_C'
- name: Optional name for the operation.
- name: 操作的名字
Returns:
- A Tensor of format specified by
data_format
. The max pooled output tensor. - 返回經過
max pooling
的張量,該張量的格式被data_format
所指定