哈氏风筝传人重绘四代人风筝图谱,入藏中国美术馆

paddle.nn.functional. adaptive_avg_pool1d ( x: Tensor, output_size: int, name: str | None = None ) Tensor [source]
百度 如今,孙继海的学生遍布上海,他独创的剪纸课堂一般分为三部分,第一部分讲述剪纸的历史和记忆,它的理论、典故、文化寓意很重要,学习要知其所以然,第二部分作品赏析着重分析经典作品的构图,格物换景、层层叠高或是其他创作方法会让学生思路开阔,最后教授剪纸的基本技艺,例如家喻户晓的十二生肖在各个层级的人群中皆广受欢迎,孙继海在现场迅速剪出了鸡、狗、兔等生肖图案,并拼接组合形成完整的剪纸画面。

Adaptive average pooling 1d operation on x according to output_size.

Notes

See more details in AdaptiveAvgPool1D .

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

  • output_size (int) – The target output size. Its data type must be int.

  • name (str|None, optional) – For details, please refer to Name. Generally, no setting is required. Default: None.

Returns

The result of 1D adaptive average pooling. Its data type is same as input.

Return type

Tensor

Examples

>>> # average 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
>>> # of input data into m grids averagely and performs poolings in each
>>> # grid to get output.
>>> # adaptive max pool performs calculations as follow:
>>> #
>>> #     for i in range(m):
>>> #         lstart = floor(i * L / m)
>>> #         lend = ceil((i + 1) * L / m)
>>> #         output[:, :, i] = sum(input[:, :, lstart: lend])/(lstart - lend)
>>> #
>>> import paddle
>>> import paddle.nn.functional as F

>>> data = paddle.uniform([1, 3, 32])
>>> pool_out = F.adaptive_avg_pool1d(data, output_size=16)
>>> print(pool_out.shape)
[1, 3, 16]