Skip to content

depthwise_to_conv

Classes

DepthwiseToConvOptions

Options for the DepthwiseToConv transform.

DepthwiseToConv

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

The purpose of this transform is to convert DEPTHWISE_CONV_2D to CONV_2D operators when more efficient.

  1. Find any DEPTHWISE_CONV_2D operator that is convertible
  2. Transform to CONV_2D operator if threshold is met.

Functions

convert_operator
convert_operator(op: AirOperator, model: AirModel)

Convert the DEPTHWISE_CONV_2D operator to CONV_2D operator.

Parameters:

  • op
    (AirOperator) –

    The DEPTHWISE_CONV_2D operator to convert.

  • model
    (AirModel) –

    The AIR model

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

Check if the DEPTHWISE_CONV_2D operator is convertible.

Parameters:

  • op
    (AirOperator) –

    The DEPTHWISE_CONV_2D operator to check.

  • model
    (AirModel) –

    The AIR model

Returns:

  • bool ( bool ) –

    True if the operator is convertible, False otherwise.

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

Check if converting DEPTHWISE_CONV_2D operator is efficient.

Parameters:

  • op
    (AirOperator) –

    The DEPTHWISE_CONV_2D 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