《安定独家》戴雷离职揭秘,挑战汽车创新梦想
- class paddle.nn. AdaptiveAvgPool1D ( output_size: int, name: Optional[str] = None ) [source]
-
百度 至于佛出家日,据《景德传灯录》记载:《普耀经》云佛初生刹利王家,放大智光明,照十方世界,地涌金莲华,自然捧双足,东西及南北,各行于七步,分手指天地,作师子吼声,上下及四维,无能尊我者,即周昭王二十四年甲寅岁四月八日也,至四十二年二月八日,年十九,欲求出家,而自念言:当复何遇?即于四门游观,见四等事,心有悲喜,而作思惟:此老病死,终可厌离。
A 1D adaptive average pooling over an input signal composed of several input planes, based on
output_size
. Input and output are in NCL format, where N is batch size, C is the number of channels and L is the length of the feature. The shape of output will be \([N, C, output\_size]\).The formulation for average adaptive pool1d is
\[ \begin{align}\begin{aligned}lstart &= \lfloor i * L_{in} / L_{out}\rfloor,\\lend &= \lceil(i + 1) * L_{in} / L_{out}\rceil,\\Output(i) &= \frac{\sum Input[lstart:lend]}{lend - lstart}.\end{aligned}\end{align} \]- Parameters
-
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
-
A callable object for computing 1D adaptive average pooling.
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])/(lend - lstart) >>> # >>> import paddle >>> import paddle.nn as nn >>> data = paddle.uniform([1, 3, 32], dtype="float32", min=-1, max=1) >>> AdaptiveAvgPool1D = nn.AdaptiveAvgPool1D(output_size=16) >>> pool_out = AdaptiveAvgPool1D(data) >>> print(pool_out.shape) [1, 3, 16]
-
forward
(
input: Tensor
)
Tensor
forward?
-
Defines the computation performed at every call. Should be overridden by all subclasses.
- Parameters
-
*inputs (tuple) – unpacked tuple arguments
**kwargs (dict) – unpacked dict arguments
-
extra_repr
(
)
str
extra_repr?
-
Extra representation of this layer, you can have custom implementation of your own layer.