average_pool_2d
Classes
AveragePool2DOperator
AveragePool2DOperator(op: AirOperator, model: AirModel, platform: SocPlatform, prefix: str = 'aot', attributes: dict[str, str] = {})
AVERAGE_POOL_2D operator.
This operator computes the average pooling of a tensor.
Parameters:
-
(opAirOperator) –The AIR operator to wrap.
-
(modelAirModel) –The AIR model.
-
(platformSocPlatform) –The target platform for code generation.
-
(prefixstr, default:'aot') –Prefix for generated code files. Defaults to "aot".
-
(attributesdict[str, str], default:{}) –Attributes for template values. Defaults to {}.
Functions
ctx_buf_required
Whether the dispatched avgpool kernel dereferences ctx->buf.
Derived from the upstream preprocessor structure rather than from
:meth:compute_scratch_size, so the two are independent statements of
the same rule and the resolve-time guard actually cross-checks them.
In arm_avgpool_s8.c / arm_avgpool_s16.c (v7.29.0) the whole
ARM_MATH_MVEI branch opens with (void)ctx;; only the scalar/DSP
branch takes int32_t *buffer = (int32_t *)ctx->buf;, and that read
sits under #if defined(ARM_MATH_DSP). The float kernels
(arm_avg_pool_f32 / _f16) are (void)ctx; outright.
Returns:
-
bool–Trueon a non-MVE, DSP-capable target with an integer output.
compute_scratch_size
Compute the scratch size for the operator in bytes.
Returns:
-
int(int) –Computed scratch size in bytes.
compute_values
emit
Generate the source code for the operator.
Parameters:
-
(save_pathPath) –Path to save the generated code.