Skip to main content

ClikaRT::ops::avg_pool

function

avg_pool()

Tensor avg_pool(
    Tensor x,
    ClikaRT::Span<const std::int64_t> kernel_size,
    ClikaRT::Span<const std::int64_t> stride,
    ClikaRT::Span<const std::int64_t> padding,
    bool ceil_mode,
    bool count_include_pad,
    std::optional<int64_t> divisor_override
)

Rank-generic average pooling, channels-last.

x is [N, D1..Dn, C]; the window rank is read from kernel_size's length. Each output element averages its window; count_include_pad decides whether padded positions count in the divisor, and divisor_override replaces the divisor outright.

Parameters

  • x: the input, [N, D1..Dn, C].
  • kernel_size: window extent per spatial dim.
  • stride: window step; empty = kernel_size.
  • padding: implicit zero padding per spatial dim.
  • ceil_mode: round output extents up; default false.
  • count_include_pad: count padding in the mean's divisor.
  • divisor_override: fixed divisor instead of the window count; absent = the window count.

Returns: the pooled tensor, [N, D1'..Dn', C], dtype of x.

Throws

  • ClikaRT::Error: (INVALID_ARGUMENT) when the parameter ranks disagree.

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