Skip to content

sub

Classes

SubOperator

SubOperator(op: AirOperator, model: AirModel, platform: SocPlatform, prefix: str = 'aot', attributes: dict[str, str] | None = None)

SUB operator.

Computes element-wise subtraction between two tensors.

Functions

cmsis_float_dependencies
cmsis_float_dependencies() -> set[type]

Narrow the declared float dependency to what this node actually binds.

Only the equal-shape lowering calls arm_elementwise_sub_f32; the scalar-broadcast fallback is a plain C loop over float, which needs neither arm_nnfunctions_flt.h nor ARM_NN_ENABLE_F32. Declaring float32 there is not merely untidy: the module handler turns the dependency into an #error in <prefix>_common.h and a FATAL_ERROR in the generated CMake when the library is built without ARM_NN_ENABLE_F32 (its default), so a float32 module that uses nothing from the float API would stop configuring.

float16 is kept on both paths: the fallback still binds float16_t, a type that only arm_nnfunctions_flt.h provides.

Returns:

  • set[type]

    set[type]: Subset of {np.float16, np.float32} this node needs.

Functions