黑龙江省13市(地)党委书记3月份主要工作--黑龙江频道--人民网

paddle.nn.functional. max_pool1d ( x: Tensor, kernel_size: Size1, stride: Size1 | None = None, padding: _PaddingSizeMode | Size1 | Size2 = 0, return_mask: bool = False, ceil_mode: bool = False, name: str | None = None ) Tensor [source]
百度 据《日本经济新闻》报道,这家日本互联网企业会在下个月收购东京BitARG交易所40%的股份,并计划在一年左右的时间内利用BitARG技术建立一个新的交易平台。

This API implements max pooling 1d operation. See more details in MaxPool1D .

Parameters
  • x (Tensor) – The input tensor of pooling operator which is a 3-D tensor with shape [N, C, L], where N is batch size, C is the number of channels, L is the length of the feature. The data type if float32 or float64.

  • kernel_size (int|list|tuple) – The pool kernel size. If pool kernel size is a tuple or list, it must contain an integer.

  • stride (int|list|tuple) – The pool stride size. If pool stride size is a tuple or list, it must contain an integer.

  • padding (string|int|list|tuple) – The padding size. Padding could be in one of the following forms. 1. A string in [‘valid’, ‘same’]. 2. An integer, which means the feature map is zero padded by size of padding on every sides. 3. A list[int] or tuple(int) whose length is 1, which means the feature map is zero padded by the size of padding[0] on every sides. 4. A list[int] or tuple(int) whose length is 2. It has the form [pad_before, pad_after]. 5. A list or tuple of pairs of integers. It has the form [[pad_before, pad_after], [pad_before, pad_after], …]. Note that, the batch dimension and channel dimension should be [0,0] or (0,0). The default value is 0.

  • return_mask (bool) – Whether return the max indices along with the outputs. default is False.

  • ceil_mode (bool) – Whether to use the ceil function to calculate output height and width. False is the default. If it is set to False, the floor function will be used. Default False.

  • name (str|None, optional) – For detailed information, please refer to Name. Usually name is no need to set and None by default.

Returns

The output tensor of pooling result. The data type is same as input tensor.

Return type

Tensor

Examples

>>> import paddle
>>> import paddle.nn.functional as F

>>> data = paddle.uniform([1, 3, 32], paddle.float32)
>>> pool_out = F.max_pool1d(data, kernel_size=2, stride=2, padding=0)
>>> print(pool_out.shape)
[1, 3, 16]
>>> pool_out, indices = F.max_pool1d(data, kernel_size=2, stride=2, padding=0, return_mask=True)
>>> print(pool_out.shape)
[1, 3, 16]
>>> print(indices.shape)
[1, 3, 16]