|
|
|
|
@ -976,6 +976,7 @@ def adaptive_avg_pool2d(x, output_size, data_format='NCHW', name=None):
|
|
|
|
|
if isinstance(output_size, int):
|
|
|
|
|
output_size = utils.convert_to_list(output_size, 2, 'output_size')
|
|
|
|
|
else:
|
|
|
|
|
output_size = list(output_size)
|
|
|
|
|
if output_size[0] == None:
|
|
|
|
|
output_size[0] = in_h
|
|
|
|
|
if output_size[1] == None:
|
|
|
|
|
@ -1079,6 +1080,7 @@ def adaptive_avg_pool3d(x, output_size, data_format='NCDHW', name=None):
|
|
|
|
|
if isinstance(output_size, int):
|
|
|
|
|
output_size = utils.convert_to_list(output_size, 3, 'output_size')
|
|
|
|
|
else:
|
|
|
|
|
output_size = list(output_size)
|
|
|
|
|
if output_size[0] == None:
|
|
|
|
|
output_size[0] = in_l
|
|
|
|
|
if output_size[1] == None:
|
|
|
|
|
@ -1123,8 +1125,7 @@ def adaptive_max_pool1d(x, output_size, return_indices=False, name=None):
|
|
|
|
|
with shape [N, C, L]. The format of input tensor is NCL,
|
|
|
|
|
where N is batch size, C is the number of channels, L is the
|
|
|
|
|
length of the feature. The data type is float32 or float64.
|
|
|
|
|
output_size (int|list|tuple): The pool kernel size. If pool kernel size is a tuple or list,
|
|
|
|
|
it must contain one int.
|
|
|
|
|
output_size (int): The pool kernel size. The value should be an integer.
|
|
|
|
|
return_indices (bool): If true, the index of max pooling point will be returned along
|
|
|
|
|
with outputs. It cannot be set in average pooling type. Default False.
|
|
|
|
|
name(str, optional): For detailed information, please refer
|
|
|
|
|
@ -1134,9 +1135,10 @@ def adaptive_max_pool1d(x, output_size, return_indices=False, name=None):
|
|
|
|
|
Tensor: The output tensor of adaptive pooling result. The data type is same
|
|
|
|
|
as input tensor.
|
|
|
|
|
Raises:
|
|
|
|
|
ValueError: 'output_size' should be a integer or list or tuple with length as 1.
|
|
|
|
|
ValueError: 'output_size' should be an integer.
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
# max adaptive pool1d
|
|
|
|
|
# suppose input data in shape of [N, C, L], `output_size` is m or [m],
|
|
|
|
|
# output shape is [N, C, m], adaptive pool divide L dimension
|
|
|
|
|
@ -1162,7 +1164,7 @@ def adaptive_max_pool1d(x, output_size, return_indices=False, name=None):
|
|
|
|
|
check_variable_and_dtype(x, 'x', ['float32', 'float64'],
|
|
|
|
|
'adaptive_max_pool1d')
|
|
|
|
|
_check_input(x, 3)
|
|
|
|
|
check_type(output_size, 'pool_size', (int), 'adaptive_max_pool1d')
|
|
|
|
|
check_type(output_size, 'pool_size', int, 'adaptive_max_pool1d')
|
|
|
|
|
check_type(return_indices, 'return_indices', bool, 'adaptive_max_pool1d')
|
|
|
|
|
|
|
|
|
|
pool_size = [1] + utils.convert_to_list(output_size, 1, 'pool_size')
|
|
|
|
|
@ -1201,15 +1203,19 @@ def adaptive_max_pool2d(x, output_size, return_indices=False, name=None):
|
|
|
|
|
"""
|
|
|
|
|
This operation applies a 2D adaptive max pooling on input tensor.
|
|
|
|
|
See more details in :ref:`api_nn_pooling_AdaptiveMaxPool2d` .
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
x (Tensor): The input tensor of adaptive max pool2d operator, which is a 4-D tensor. The data type can be float16, float32, float64, int32 or int64.
|
|
|
|
|
output_size (int|list|tuple): The pool kernel size. If pool kernel size is a tuple or list, it must contain two elements, (H, W). H and W can be either a int, or None which means the size will be the same as that of the input.
|
|
|
|
|
return_indices (bool): If true, the index of max pooling point will be returned along with outputs. Default False.
|
|
|
|
|
name(str, optional): For detailed information, please refer to :ref:`api_guide_Name`. Usually name is no need to set and None by default.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
Tensor: The output tensor of adaptive max pool2d result. The data type is same as input tensor.
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
# max adaptive pool2d
|
|
|
|
|
# suppose input data in the shape of [N, C, H, W], `output_size` is [m, n]
|
|
|
|
|
# output shape is [N, C, m, n], adaptive pool divide H and W dimensions
|
|
|
|
|
@ -1247,6 +1253,7 @@ def adaptive_max_pool2d(x, output_size, return_indices=False, name=None):
|
|
|
|
|
if isinstance(output_size, int):
|
|
|
|
|
output_size = utils.convert_to_list(output_size, 2, 'output_size')
|
|
|
|
|
else:
|
|
|
|
|
output_size = list(output_size)
|
|
|
|
|
if output_size[0] == None:
|
|
|
|
|
output_size[0] = in_h
|
|
|
|
|
if output_size[1] == None:
|
|
|
|
|
@ -1283,15 +1290,19 @@ def adaptive_max_pool3d(x, output_size, return_indices=False, name=None):
|
|
|
|
|
"""
|
|
|
|
|
This operation applies a 3D adaptive max pooling on input tensor.
|
|
|
|
|
See more details in :ref:`api_nn_pooling_AdaptiveMaxPool3d` .
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
|
x (Tensor): The input tensor of adaptive max pool3d operator, which is a 5-D tensor. The data type can be float32, float64.
|
|
|
|
|
output_size (int|list|tuple): The pool kernel size. If pool kernel size is a tuple or list, it must contain three elements, (D, H, W). D, H and W can be either a int, or None which means the size will be the same as that of the input.
|
|
|
|
|
return_indices (bool): If true, the index of max pooling point will be returned along with outputs. Default False.
|
|
|
|
|
name(str, optional): For detailed information, please refer to :ref:`api_guide_Name`. Usually name is no need to set and None by default.
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
|
Tensor: The output tensor of adaptive max pool3d result. The data type is same as input tensor.
|
|
|
|
|
|
|
|
|
|
Examples:
|
|
|
|
|
.. code-block:: python
|
|
|
|
|
|
|
|
|
|
# adaptive max pool3d
|
|
|
|
|
# suppose input data in the shape of [N, C, D, H, W], `output_size` is [l, m, n]
|
|
|
|
|
# output shape is [N, C, l, m, n], adaptive pool divide D, H and W dimensions
|
|
|
|
|
@ -1333,6 +1344,7 @@ def adaptive_max_pool3d(x, output_size, return_indices=False, name=None):
|
|
|
|
|
if isinstance(output_size, int):
|
|
|
|
|
output_size = utils.convert_to_list(output_size, 3, 'output_size')
|
|
|
|
|
else:
|
|
|
|
|
output_size = list(output_size)
|
|
|
|
|
if output_size[0] == None:
|
|
|
|
|
output_size[0] = in_l
|
|
|
|
|
if output_size[1] == None:
|
|
|
|
|
|