Skip to content

mean

Classes

MeanOperator

MeanOperator(ident: int, op: OperatorT, model: ModelT, subgraph: SubGraphT, prefix: str = 'aot', attributes: dict[str, str] = {})

MEAN operator.

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

Parameters:

  • ident

    (int) –

    Operator identifier.

  • op

    (OperatorT) –

    Operator object from LiteRT model.

  • model

    (ModelT) –

    LiteRT model object.

  • subgraph

    (SubGraphT) –

    Subgraph object from LiteRT model.

  • prefix

    (str, default: 'aot' ) –

    Prefix for generated files. Defaults to "aot".

  • attributes

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

    Attributes for template values. Defaults to {}.

Attributes

name property
name: str

Return the operator name.

input_indices property
input_indices: list[int]

Return the input tensor indices.

output_indices property
output_indices: list[int]

Return the output tensor indices.

input_tensors property
input_tensors: list[TensorT]

Return the input tensors.

output_tensors property
output_tensors: list[TensorT]

Return the output tensors.

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.

generate_source_code
generate_source_code(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_multiplier, base_shift, count)

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_multiplier

    (int) –

    Base multiplier to adjust.

  • base_shift

    (int) –

    Base shift to adjust.

  • count

    (int) –

    Count to fold into the multiplier.