Skip to main content

ClikaRT::ops::avg_pool2d

function

avg_pool2d()

Tensor avg_pool2d(
    Tensor x,
    ClikaRT::Span<const std::int64_t> kernel_size,
    ClikaRT::Span<const std::int64_t> stride = {},
    ClikaRT::Span<const std::int64_t> padding = {0, 0},
    bool ceil_mode = false,
    bool count_include_pad = true,
    std::optional<int64_t> divisor_override = std::nullopt
)

2-D average pooling over [N, H, W, C] (channels-last).

Averages each kernel_size window; count_include_pad includes the zero padding in the divisor; divisor_override fixes the divisor. stride empty = kernel_size.

Parameters

  • x: the input, [N, H, W, C].
  • kernel_size: {kH, kW}.
  • stride: {sH, sW}; empty = kernel_size.
  • padding: {pH, pW}; default {0, 0}.
  • ceil_mode: round output extents up; default false.
  • count_include_pad: count padding in the divisor; default true.
  • divisor_override: fixed divisor; absent = window count.

Returns: [N, H', W', C], dtype of x.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) on mismatched parameter ranks.

Declared in ClikaRT/compute/ops.h, line 3916