@tf_export('layers.max_pooling2d')defmax_pooling2d(inputs,
pool_size, strides,
padding='valid', data_format='channels_last',
name=None):"""Max pooling layer for 2D inputs (e.g. images).
2D输入(例如图像)的最大池化层。
Arguments:
inputs: The tensor over which to pool. Must have rank 4.
要合并(池化)的张量。 必须具有等级4。
pool_size: An integer or tuple/list of 2 integers: (pool_height, pool_width)
specifying the size of the pooling window.
Can be a single integer to specify the same value for
all spatial dimensions.
一个整数或2个整数的元组/列表:(pool_height,pool_width)指定池窗口的大小。
可以是单个所有空间尺寸。
strides: An integer or tuple/list of 2 integers,
specifying the strides of the pooling operation.
Can be a single integer to specify the same value for
all spatial dimensions.
一个整数或2个整数的元组/列表,指定池操作的步幅。
可以是单个整数,以为所有空间尺寸指定相同的值。
padding: A string. The padding method, either 'valid' or 'same'.
Case-insensitive.
一个字符串。 填充方法,“有效”或“相同”。 不区分大小写。
data_format: A string. The ordering of the dimensions in the inputs.
`channels_last` (default) and `channels_first` are supported.
`channels_last` corresponds to inputs with shape
`(batch, height, width, channels)` while `channels_first` corresponds to
inputs with shape `(batch, channels, height, width)`.
一个字符串。 输入中尺寸的顺序。 支持`channels_last`(默认)和`channels_first`。
“ channels_last”对应于形状为((批,高度,宽度,通道))的输入,而“ channels_first”对应于形状为((批,通道,高度,宽度)的输入。
name: A string, the name of the layer.
字符串,层的名称。
Returns:
Output tensor. 输出张量。
Raises:
ValueError: if eager execution is enabled.
ValueError:如果启用了急切执行。
"""
layer = MaxPooling2D(pool_size=pool_size, strides=strides,
padding=padding, data_format=data_format,
name=name)return layer.apply(inputs)