oneflow.nn.functional.adaptive_avg_pool2d

oneflow.nn.functional.adaptive_avg_pool2d(input, output_size)Tensor

Applies a 2D adaptive average pooling over an input signal composed of several input planes.

See AdaptiveAvgPool2d for details and output shape.

Parameters
  • input – the input tensor

  • output_size – the target output size (single integer or double-integer tuple)

For examples:

>>> import oneflow as flow
>>> import numpy as np

>>> arr = np.array([[[[ 0.1004,  0.0488, -1.0515,  0.9466],[ 0.4538,  0.2361,  1.3437,  0.398 ],[ 0.0558, -0.6875, -1.6544, -0.6226],[ 0.1018,  0.0502, -1.2538,  0.1491]]]])
>>> input = flow.tensor(arr, dtype=flow.float32)
>>> outputs = flow.nn.functional.adaptive_avg_pool2d(input, (2, 2))