Skip to content

transpose_reverse_conv

Classes

TransposeReverseConvOptions

Options for the TransposeReverseConv transform.

TransposeReverseConv

TransposeReverseConv(enabled: bool = True, options: dict[str, Any] | None = None)

The purpose of this transform is to convert TRANSPOSE_CONV to CONV_2D operators when possible and efficient.

  1. Find any TRANSPOSE_CONV operator that is reversible
  2. Transform to CONV_2D operator if threshold is met.

Functions

convert_operator
convert_operator(op: AirOperator, model: AirModel)

Convert the TRANSPOSE_CONV operator to CONV_2D operator.

Parameters:

  • op
    (AirOperator) –

    The TRANSPOSE_CONV operator to convert.

  • model
    (AirModel) –

    The AIR model

is_reversible
is_reversible(op: AirOperator, model: AirModel) -> bool

Check if the TRANSPOSE_CONV operator is reversible.

Parameters:

  • op
    (AirOperator) –

    The TRANSPOSE_CONV operator to check.

  • model
    (AirModel) –

    The AIR model

Returns:

  • bool ( bool ) –

    True if the operator is reversible, False otherwise.

is_float
is_float(op: AirOperator, model: AirModel) -> bool

Whether the operator produces a float (f16/f32) output.

Float transpose-convolution must keep its native arm_transpose_conv_f32/_f16 lowering: rewriting it to a plain CONV_2D would encode the stride upscaling as upscale_height/width, which the CMSIS-NN float convolution kernels do not support and would silently drop. Only quantized (s8) transpose-convs, whose CONV_2D path honours the arm_convolve_s8 upscale argument, are eligible.

Parameters:

Returns:

  • bool ( bool ) –

    True if the operator's output tensor is float16/

  • bool

    float32.

is_efficient
is_efficient(op: AirOperator, model: AirModel) -> bool

Check if the TRANSPOSE_CONV operator is efficient to convert.

Parameters:

  • op
    (AirOperator) –

    The TRANSPOSE_CONV operator to check.

  • model
    (AirModel) –

    The AIR model

Returns:

  • bool ( bool ) –

    True if the operator is efficient to convert, False otherwise.

apply
apply(model: AirModel) -> AirModel

Apply the transform.

Parameters:

  • model
    (AirModel) –

    The model to transform.

Returns:

  • AirModel ( AirModel ) –

    The transformed model.

Functions