Skip to content

options

Classes

AirOperatorOptions

Marker base for operator-specific configurations.

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.

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).

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).

AirAddOptions

Options for the ADD operator.

Attributes:

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).

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).

AirDequantizeOptions

Options for the DEQUANTIZE operator.

AirExpandDimsOptions

Options for the EXPAND_DIMS operator.

AirFillOptions

Options for the FILL operator.

Attributes:

  • fill_value (int) –

    The value to fill the output tensor with (default 0).

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).

AirMinimumOptions

Options for the Minimum operator.

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).

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).

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.

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.

AirTransposeOptions

Options for the TRANSPOSE operator.

Attributes:

  • perm (list[int] | None) –

    The permutation of the dimensions of the input tensor.

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).

AirZerosLikeOptions

Options for the ZEROS_LIKE operator.

Attributes:

  • zero_point (int) –

    The zero point for the ZEROS_LIKE operator.

Functions

register_op_options

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

1) Ensures the decorated class inherits from AirOperatorOptions, 2) Converts it into a @dataclass(**dataclass_kwargs), 3) Registers it under the given op_type string, 4) Returns the resulting dataclass.

Usage

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

get_options_class

get_options_class(op_type: AirOpType) -> 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: