Skip to content

options

Classes

AirOperatorOptions

Marker base for operator-specific configurations.

AirAddOptions

Options for the ADD operator.

Attributes:

AirSubOptions

Options for the SUB operator.

Attributes:

AirSquaredDifferenceOptions

Options for the SQUARED_DIFFERENCE operator.

AirAssignVariableOptions

Options for the ASSIGN_VARIABLE operator.

AirAveragePool2DOptions

Options for the AVERAGE_POOL_2D operator.

Attributes:

  • padding_height (int) –

    number of rows to pad at top & bottom (default 0).

  • padding_width (int) –

    number of columns to pad at left & right (default 0).

  • stride_height (int) –

    vertical step between pooling windows (default 1).

  • stride_width (int) –

    horizontal step between pooling windows (default 1).

  • filter_height (int) –

    height of the pooling window (default 1).

  • filter_width (int) –

    width of the pooling window (default 1).

  • activation (AirActivationType) –

    fused activation function (default NONE).

AirBatchMatMulOptions

Options for the BATCH_MATMUL operator.

Attributes:

  • adj_x (bool) –

    If True, transpose the first (left) input matrix before multiplication (default False).

  • adj_y (bool) –

    If True, transpose the second (right) input matrix before multiplication (default False).

  • asymmetric_quantize_inputs (bool) –

    If True, use asymmetric quantization for inputs (default False).

AirBatchToSpaceNDOptions

Options for the BATCH_TO_SPACE_ND operator.

Attributes:

  • block_shape (tuple[int, int]) –

    The size of the spatial block (default (1, 1)).

  • crops (tuple[int, int, int, int]) –

    Crops for the spatial dimensions (default (0, 0, 0, 0)).

AirConcatenationOptions

Options for the CONCATENATION operator.

Attributes:

  • axis (int) –

    Axis along which to concatenate the input tensors (default 0).

  • activation (AirActivationType) –

    Activation function to apply after concatenation (default NONE).

AirConv2DOptions

Options for CONV_2D.

Attributes:

  • padding_height (int) –

    padding for top & bottom (default 0).

  • padding_width (int) –

    padding for left & right (default 0).

  • stride_height (int) –

    vertical stride (default 1).

  • stride_width (int) –

    horizontal stride (default 1).

  • dilation_height (int) –

    vertical dilation (default 1).

  • dilation_width (int) –

    horizontal dilation (default 1).

  • activation (AirActivationType) –

    fused activation function (default NONE).

  • bias_tensor_type (AirTensorType) –

    bias tensor type.

  • upscale_height (int) –

    implicit height upscaling factor applied before convolution.

  • upscale_width (int) –

    implicit width upscaling factor applied before convolution.

AirDepthToSpaceOptions

Options for the DEPTH_TO_SPACE operator.

Attributes:

  • block_size (int) –

    The size of the spatial block (default 0).

AirDepthwiseConv2DOptions

Options for the DEPTHWISE_CONV_2D operator.

Attributes:

  • depth_multiplier (int) –

    number of output channels per input channel (default 1).

  • padding_height (int) –

    padding for top & bottom (default 0).

  • padding_width (int) –

    padding for left & right (default 0).

  • stride_height (int) –

    vertical stride (default 1).

  • stride_width (int) –

    horizontal stride (default 1).

  • dilation_height (int) –

    vertical dilation factor (default 1).

  • dilation_width (int) –

    horizontal dilation factor (default 1).

  • activation (AirActivationType) –

    fused activation function (default NONE).

AirDequantizeOptions

Options for the DEQUANTIZE operator.

AirExpandDimsOptions

Options for the EXPAND_DIMS operator.

AirFillOptions

Options for the FILL operator.

AirFullyConnectedOptions

Options for the FULLY_CONNECTED operator.

Attributes:

  • activation (AirActivationType) –

    Fused activation function (default NONE).

  • weights_format (FullyConnectedWeightsFormat) –

    Memory layout of the weights matrix (default DEFAULT, i.e. row-major).

  • keep_num_dims (bool) –

    If True, preserve the input's rank in the output. Otherwise, collapse to 2D (default False).

  • asymmetric_quantize_inputs (bool) –

    If True, use asymmetric quantization for inputs (default False).

  • bias_tensor_type (AirTensorType) –

    Data type of the bias tensor. FLOAT32 for hybrid/dynamic-range quant, INT32 for full-integer quant (default FLOAT32).

AirHardSwishOptions

Options for the HARD_SWISH operator.

AirLeakyReluOptions

Options for the LEAKY_RELU operator.

Attributes:

  • alpha (float) –

    The slope for negative values (default 0.2).

AirLogisticOptions

Options for the LOGISTIC operator.

AirMaxPool2DOptions

Options for the MAX_POOL_2D operator.

Attributes:

  • padding_height (int) –

    number of rows to pad at top & bottom (default 0).

  • padding_width (int) –

    number of columns to pad at left & right (default 0).

  • stride_height (int) –

    vertical step between pooling windows (default 1).

  • stride_width (int) –

    horizontal step between pooling windows (default 1).

  • filter_height (int) –

    height of the pooling window (default 1).

  • filter_width (int) –

    width of the pooling window (default 1).

  • activation (AirActivationType) –

    fused activation function (default NONE).

AirMaximumOptions

Options for the Maximum operator.

AirMeanOptions

Options for the MEAN operator.

Attributes:

  • axis (list[int]) –

    List of axes to compute the mean over (default None).

AirSumOptions

Options for the SUM operator.

AirMinimumOptions

Options for the Minimum operator.

AirComparisonOptions

Options shared by comparison operators.

AirMulOptions

Options for the MUL operator.

Attributes:

  • activation (AirActivationType) –

    Fused activation function to apply after multiplication (default NONE).

AirPackOptions

Options for the PACK operator.

Attributes:

  • values_count (int) –

    Number of input tensors to pack (default 0).

  • axis (int) –

    Axis along which to pack the input tensors (default 0).

AirPadOptions

Options for the PAD operator.

Attributes:

  • constant_value (int) –

    Value to use for padding (default 0).

  • pre_paddings (list[int]) –

    List of padding sizes before each dimension (default None).

  • post_paddings (list[int]) –

    List of padding sizes after each dimension (default None).

AirQuantizeOptions

Options for the QUANTIZE operator.

AirReadVariableOptions

Options for the READ_VARIABLE operator.

Attributes:

  • init_value (int) –

    Initial value for the variable (default 0).

AirReduceMaxOptions

Options for the REDUCE_MAX operator.

Attributes:

  • axis (list[int]) –

    List of axes to compute the maximum over (default None).

AirReduceMinOptions

Options for the REDUCE_MIN operator.

Attributes:

  • axis (list[int]) –

    List of axes to compute the minimum over (default None).

AirArgMaxOptions

Options for the ARG_MAX operator.

AirArgMinOptions

Options for the ARG_MIN operator.

AirReluOptions

Options for the RELU operator.

Attributes:

  • relu_type (AirReluType) –

    Type of ReLU activation to use (default RELU).

AirReshapeOptions

Options for the RESHAPE operator.

Attributes:

  • new_shape (list[int] | None) –

    The new shape to reshape the input tensor to.

AirShapeOptions

Options for the SHAPE operator.

Attributes:

  • out_type (int) –

    The data type of the output tensor (default 0).

AirSoftmaxOptions

Options for the SOFTMAX operator.

Attributes:

  • beta (float) –

    The beta parameter for softmax scaling (default 1.0).

AirSpaceToBatchNDOptions

Options for the SPACE_TO_BATCH_ND operator.

Attributes:

  • block_shape (tuple[int, int]) –

    The size of the spatial block (default (1, 1)).

  • paddings (tuple[int, int, int, int]) –

    Paddings for the spatial dimensions (default (0, 0, 0, 0)).

AirSpaceToDepthOptions

Options for the SPACE_TO_DEPTH operator.

Attributes:

  • block_size (int) –

    The size of the spatial block (default 0).

AirSplitOptions

Options for the SPLIT operator.

Attributes:

  • axis (int) –

    Axis along which to split the input tensor (default 0).

  • split_lengths (list[int]) –

    List of lengths for each split (default empty list).

AirSqueezeOptions

Options for the SQUEEZE operator.

Attributes:

  • squeeze_dims (list[int] | None) –

    List of dimensions to squeeze from the input tensor.

AirSliceOptions

Options for the SLICE operator.

Functions

get_slices
get_slices(input_shape: tuple[int, ...], pad_to: int = 4) -> list[AirStrideSlice]

Compute (begin, end, stride) tuples for each axis.

AirGatherOptions

Options for the GATHER operator.

AirGatherNdOptions

Options for the GATHER_ND operator.

AirStridedSliceOptions

Options for STRIDED_SLICE operator.

Attributes:

  • begin (tuple[int, int, int, int]) –

    Begin indices for each dimension.

  • end (tuple[int, int, int, int]) –

    End indices for each dimension.

  • stride (tuple[int, int, int, int]) –

    Stride values for each dimension.

  • begin_mask (int) –

    Mask for begin indices (default 0).

  • end_mask (int) –

    Mask for end indices (default 0).

  • ellipsis_mask (int) –

    Mask for ellipsis (default 0).

  • new_axis_mask (int) –

    Mask for new axes (default 0).

  • shrink_axis_mask (int) –

    Mask for shrink axes (default 0).

  • offset (bool) –

    If True, apply offset to the begin and end indices (default False).

Functions

get_slices
get_slices(input_shape: tuple[int, ...], pad_to: int = 4) -> list[AirStrideSlice]

Compute (begin, end, stride) for each axis, padding dims and shape to pad_to dims.

Parameters:

  • input_shape
    (tuple[int, ...]) –

    The shape of the input tensor.

  • pad_to
    (int, default: 4 ) –

    The number of dimensions to pad the input shape to (default 4).

Returns:

  • list[AirStrideSlice]

    A list of AirStrideSlice, each containing (begin, end, stride) for each axis.

AirTanhOptions

Options for the TANH operator.

AirEthosUOptions

Options for the ETHOS_U operator.

Attributes:

  • co_type (int) –

    Command-stream type identifier encoded by Vela (default 0).

  • command_stream_size (int) –

    Size in bytes of the command stream tensor.

  • num_base_addresses (int) –

    Total number of base addresses (inputs excluding command stream plus outputs).

  • custom_options_format (int) –

    LiteRT CustomOptionsFormat value for the operator.

  • custom_options (tuple[int, ...]) –

    Raw custom options payload (typically Flexbuffers encoded).

AirTransposeConvOptions

Options for the TRANSPOSE_CONV operator.

Attributes:

  • padding_height (int) –

    pixels to pad input top & bottom (default 0).

  • padding_width (int) –

    pixels to pad input left & right (default 0).

  • padding_offsets_height (int) –

    Padding for top & bottom offsets (default 0).

  • padding_offsets_width (int) –

    Padding for left & right offsets (default 0).

  • stride_height (int) –

    vertical stride (default 1).

  • stride_width (int) –

    horizontal stride (default 1).

  • dilation_height (int) –

    vertical dilation factor (default 1).

  • dilation_width (int) –

    horizontal dilation factor (default 1).

  • activation (AirActivationType) –

    fused activation (default NONE).

  • bias_tensor_type (AirTensorType) –

    bias tensor type (default FLOAT32).

AirTransposeOptions

Options for the TRANSPOSE operator.

Attributes:

  • perm (list[int] | None) –

    The permutation of the dimensions of the input tensor.

AirReverseV2Options

Options for the REVERSE_V2 operator.

Attributes:

  • axes (list[int]) –

    Axes to reverse.

AirUnpackOptions

Options for the UNPACK operator.

Attributes:

  • num (int) –

    Number of output tensors to unpack (default 0).

  • axis (int) –

    Axis along which to unpack the input tensor (default 0).

AirSvdfOptions

Options for the SVDF operator.

Attributes:

  • rank (int) –

    The rank of the SVDF operation (default 1).

  • activation (AirActivationType) –

    Fused activation function (default NONE).

  • asymmetric_quantize_inputs (bool) –

    If True, use asymmetric quantization for inputs (default False).

AirZerosLikeOptions

Options for the ZEROS_LIKE operator.

Attributes:

  • zero_point (int) –

    The zero point for the ZEROS_LIKE operator.

AirPreluOptions

Options for the PReLU operator.

AirResizeNearestNeighborOptions

Options for the RESIZE_NEAREST_NEIGHBOR operator.

Attributes:

  • align_corners (bool) –

    If True, align the input and output corners (default False).

  • half_pixel_centers (bool) –

    If True, use half-pixel centers (default False).

AirAbsOptions

Options for the ABS operator.

AirSqrtOptions

Options for the SQRT operator.

AirRsqrtOptions

Options for the RSQRT operator.

Functions

register_op_options

register_op_options(op_type: AirOpType | str, **dataclass_kwargs: Any)
Decorator that

1) Ensures the decorated class inherits from AirOperatorOptions, 2) Converts it into a @dataclass(**dataclass_kwargs), 3) Annotates it with a canonical registry key, 4) Returns the resulting dataclass.

Usage

@register_op_options("Conv2D") class AirConv2DOptions: ... fields ...

register_default_air_options

register_default_air_options(registry: Registry[AirOpType | str, type[AirOperatorOptions]]) -> None

Register all built-in AIR option classes into the provided registry.

get_options_class

get_options_class(registry: Registry[AirOpType | str, type[AirOperatorOptions]], op_type: AirOpType | str) -> type[AirOperatorOptions]

Retrieve the registered options dataclass for a given op_type.

If not found, falls back to the base AirOperatorOptions.

Parameters:

  • op_type

    (AirOpType) –

    The operator type to look up.

Returns: