Skip to content

mean

Classes

MeanOperator

MeanOperator(op: AirOperator, model: AirModel, platform: SocPlatform, prefix: str = 'aot', attributes: dict[str, str] = {})

MEAN operator.

This operator computes the mean of the input tensor along specified axes.

Parameters:

  • op

    (AirOperator) –

    The AIR operator to wrap.

  • model

    (AirModel) –

    The AIR model.

  • platform

    (SocPlatform) –

    The target platform for code generation.

  • prefix

    (str, default: 'aot' ) –

    Prefix for generated code files. Defaults to "aot".

  • attributes

    (dict[str, str], default: {} ) –

    Attributes for template values. Defaults to {}.

Functions

compute_values
compute_values() -> dict[str, str]

Compute the values for the operator.

Returns:

  • dict[str, str]

    dict[str, str]: Computed values for the operator.

emit
emit(save_path: Path)

Generate the source code for the operator.

Parameters:

  • save_path
    (Path) –

    Path to save the generated code.

Functions

fold_mean_multiplier

fold_mean_multiplier(base_fp: AirFixedPointScale, count) -> AirFixedPointScale

Fold 1 / count into base_multiplier and shift, such that the result is compatible with arm_nn_requantize().

Ensures shift is in [0, 31] and multiplier fits in Q31.

Parameters:

  • base_fp

    (AirFixedPointScale) –

    Base fixed-point scale.

  • count

    (int) –

    Count to fold into the multiplier.