afe.ir.attributes ================= .. py:module:: afe.ir.attributes Attributes ---------- .. autoapisummary:: afe.ir.attributes.DEFAULT_PER_CHANNEL afe.ir.attributes.ASYMMETRY afe.ir.attributes.dummy_quant_result_tensor_type afe.ir.attributes.ACTIVATION_ATTRS afe.ir.attributes.QUANT_ACTIVATION_ATTRS Classes ------- .. autoapisummary:: afe.ir.attributes.ObservedDistribution afe.ir.attributes.QuantResultTensorType afe.ir.attributes.AwesomeCalibAttrs afe.ir.attributes.AwesomeQuantAttrBase afe.ir.attributes.PlaceholderQuantAttrs afe.ir.attributes.ConstantQuantAttrs afe.ir.attributes.ConcatQuantAttrs afe.ir.attributes.MultiplyQuantAttrs afe.ir.attributes.LeakyReluQuantAttrs afe.ir.attributes.AwesomeAttributes afe.ir.attributes.PlaceholderAttrs afe.ir.attributes.ConstantAttrs afe.ir.attributes.MultiplyAttrs afe.ir.attributes.ConvAttrs afe.ir.attributes.PoolAttrs afe.ir.attributes.MaxPoolAttrs afe.ir.attributes.AvgPoolAttrs afe.ir.attributes.VarianceAttrs afe.ir.attributes.AdaptiveAvgPool2DAttrs afe.ir.attributes.ReluAttrs afe.ir.attributes.AddAttrs afe.ir.attributes.SubtractAttrs afe.ir.attributes.BiasAddAttrs afe.ir.attributes.ConstantMultiplyAddAttrs afe.ir.attributes.MeanAttrs afe.ir.attributes.MeanQuantAttrs afe.ir.attributes.ArgMaxAttrs afe.ir.attributes.LayerNormAttrs afe.ir.attributes.RMSNormAttrs afe.ir.attributes.InstanceNormAttrs afe.ir.attributes.SoftmaxAttrs afe.ir.attributes.PadAttrs afe.ir.attributes.LRNAttrs afe.ir.attributes.ClipAttrs afe.ir.attributes.ExtmAttrs afe.ir.attributes.SumAttrs afe.ir.attributes.ProdAttrs afe.ir.attributes.FullAttrs afe.ir.attributes.TileAttrs afe.ir.attributes.UpsamplingAttrs afe.ir.attributes.ImageResize2DAttrs afe.ir.attributes.GridSampleAttrs afe.ir.attributes.MaximumAttrs afe.ir.attributes.MinimumAttrs afe.ir.attributes.TensorManipulationBaseAttrs afe.ir.attributes.TupleAttrs afe.ir.attributes.TupleGetItemAttrs afe.ir.attributes.SqueezeAttrs afe.ir.attributes.ConcatenateAttrs afe.ir.attributes.TransposeAttrs afe.ir.attributes.DepthToSpaceAttrs afe.ir.attributes.ReshapeAttrs afe.ir.attributes.ExpandDimsAttrs afe.ir.attributes.BatchFlattenAttrs afe.ir.attributes.SplitAttrs afe.ir.attributes.TakeAttrs afe.ir.attributes.StridedSliceAttrs afe.ir.attributes.LayoutTransformAttrs afe.ir.attributes.BroadcastToAttrs afe.ir.attributes.TessellationTransformAttrs afe.ir.attributes.DetessellationTransformAttrs afe.ir.attributes.PackTransformAttrs afe.ir.attributes.UnpackTransformAttrs afe.ir.attributes.NormalizationTransformAttrs afe.ir.attributes.QuantizationTransformAttrs afe.ir.attributes.DequantizationTransformAttrs afe.ir.attributes.ResizeTransformAttrs afe.ir.attributes.ChromaUpsampleTransformAttrs afe.ir.attributes.YuvRgbConversionTransformAttrs afe.ir.attributes.BgrRgbConversionTransformAttrs afe.ir.attributes.SigmoidTransformAttrs afe.ir.attributes.NmsMaxpoolTransformAttrs afe.ir.attributes.CastAttrs afe.ir.attributes.UDFAttrs afe.ir.attributes.LeakyReluAttrs afe.ir.attributes.SwishAttrs afe.ir.attributes.PReluAttrs afe.ir.attributes.ClipQuantAttrs afe.ir.attributes.ReluQuantAttrs afe.ir.attributes.AddActivationAttrs afe.ir.attributes.ConvAddActivationAttrs afe.ir.attributes.TupleConcatenateAttrs afe.ir.attributes.ExternalAttrs afe.ir.attributes.QNNQuantizeAttrs afe.ir.attributes.QNNDequantizeAttrs afe.ir.attributes.RequantizeAttrs afe.ir.attributes.CustomOpAttrs afe.ir.attributes.AddQuantAttrs afe.ir.attributes.SubtractQuantAttrs afe.ir.attributes.ConvQuantAttrs afe.ir.attributes.UpsamplingQuantAttrs afe.ir.attributes.ImageResize2DQuantAttrs afe.ir.attributes.LRNQuantAttrs afe.ir.attributes.LayerNormQuantAttrs afe.ir.attributes.InstanceNormQuantAttrs afe.ir.attributes.RMSNormQuantAttrs afe.ir.attributes.SoftmaxQuantAttrs afe.ir.attributes.RequantizeQuantAttrs afe.ir.attributes.ConcatQuantAttrs afe.ir.attributes.CustomOpQuantAttrs afe.ir.attributes.PoolQuantAttrs afe.ir.attributes.VarianceQuantAttrs afe.ir.attributes.UDFQuantAttrs afe.ir.attributes.DivideAttrs afe.ir.attributes.DivideQuantAttrs afe.ir.attributes.LeakyReluCompositeQuantAttrs afe.ir.attributes.PReluQuantAttrs afe.ir.attributes.PowerAttrs afe.ir.attributes.ArgMaxQuantAttrs afe.ir.attributes.BatchMatmulAttrs afe.ir.attributes.BatchMatmulQuantAttrs afe.ir.attributes.SliceConcatAttrs afe.ir.attributes.SliceConcatQuantAttrs afe.ir.attributes.BroadcastToQuantAttrs Functions --------- .. autoapisummary:: afe.ir.attributes.get_quant_result_scale_with_dummy afe.ir.attributes.get_data_value_quant_result_scale_with_dummy afe.ir.attributes.get_dict_quant_result_scale_with_dummy afe.ir.attributes.update_quant_result_quantization afe.ir.attributes.update_quant_result_type afe.ir.attributes.set_quant_result_type_batch_size afe.ir.attributes.is_dummy_type afe.ir.attributes.convolution_output_shape Module Contents --------------- .. py:data:: DEFAULT_PER_CHANNEL :value: False .. py:data:: ASYMMETRY :value: True .. py:class:: ObservedDistribution(observer: afe.ir.node_observer.NodeObserver) A value distribution that was observed during calibration. This value distribution can be used to decide how to quantize a tensor. .. py:method:: calculate_quantization(qrange: Tuple[int, int]) -> afe.ir.defines.DataValue[afe.ir.defines.Quantization] Choose a quantization to use for representing the observed value distribution using the given integer range. :param qrange: Integer range to quantize for. The range must be representable by an 8-bit or 16-bit signed integer. :return: Selected quantizations. .. py:method:: get_min_max() -> Tuple[float, float] Get range (min and max) of observed values. Min-max range does not need to include zero. :return: Tuple of min and max values. .. py:method:: get_mean() .. py:class:: QuantResultTensorType The result of running the quantization transformation on a tensor. It has the tensor's type and quantization, as they are after the transformation. Only tensors that are quantized by the transformation have a quantization. :param type: The tensor's type after transformation. It has the same shape as before the transformation. Its scalar type may be different. :param quant: The tensor's quantization, if it was quantized by the quantization transformation. None otherwise. Floating-point tensors do not have a quantization. Integer tensors do not have a quantization if they were already integer before the quantization transformation. :param requant_method: The method that should be used for requantizing this tensor's value when requantization is needed. This field must be None iff quant is None. .. py:attribute:: type :type: afe.ir.tensor_type.TensorType .. py:attribute:: quant :type: Optional[afe.ir.defines.Quantization] .. py:attribute:: requant_method :type: Optional[afe.ir.defines.RequantMethod] .. py:method:: from_type(type: afe.ir.tensor_type.TensorType) -> QuantResultTensorType :staticmethod: Make a QuantResultTensorType that only has type information. .. py:method:: from_quant(quant: Optional[afe.ir.defines.Quantization]) -> QuantResultTensorType :staticmethod: Make a QuantResultTensorType from a Quantization using dummy type information. This is a temporary method that should be removed when support for QuantResultTensorType is finished. .. py:function:: get_quant_result_scale_with_dummy(t: QuantResultTensorType) -> afe.ir.defines.Quantization Get the quantization scale; if there is none, return a dummy value. The dummy value is a temporary solution that should be removed when support for QuantResultTensorType is finished. .. py:function:: get_data_value_quant_result_scale_with_dummy(t: afe.ir.defines.DataValue[QuantResultTensorType]) -> afe.ir.defines.DataValue[afe.ir.defines.Quantization] Run get_quant_result_scale_with_dummy on the contents of a DataValue. .. py:function:: get_dict_quant_result_scale_with_dummy(t: Dict[afe.ir.defines.InputName, afe.ir.defines.DataValue[QuantResultTensorType]]) -> Dict[afe.ir.defines.InputName, afe.ir.defines.DataValue[afe.ir.defines.Quantization]] Run get_quant_result_scale_with_dummy on the contents of a dict of DataValue. .. py:function:: update_quant_result_quantization(t: afe.ir.defines.DataValue[QuantResultTensorType], new_quant: afe.ir.defines.DataValue[afe.ir.defines.Quantization]) -> afe.ir.defines.DataValue[QuantResultTensorType] Insert the given quantization into t, replacing existing quantization values in t. :param t: Quantization result type to modify :param new_quant: Quantization values :return: A copy of t with values from new_type inserted .. py:function:: update_quant_result_type(t: afe.ir.defines.DataValue[QuantResultTensorType], new_type: afe.ir.defines.DataValue[afe.ir.tensor_type.TensorType]) -> afe.ir.defines.DataValue[QuantResultTensorType] Ensure that t's type matches new_type by replacing dummy types with data from t and checking non-dummy types. This function's purpose is to save the type into t while developing QuantResultTensorType, then to check consistency after it is developed. :param t: Quantization result type, which may contain dummy types :param new_type: Type that should be the same as the type in t :return: A copy of t with values from new_type inserted to replace any dummy types .. py:function:: set_quant_result_type_batch_size(t: afe.ir.defines.DataValue[QuantResultTensorType], batch_size: int) -> afe.ir.defines.DataValue[QuantResultTensorType] Modifies DataValue of QuantResultTensorType with given batch size. :param t: DataValue[QuantResultTensorType]. Value to be modified. :param batch_size: int. Batch size value to be used in constructing new QuantResultTensorType DataValue. :return: DataValue[QuantResultTensorType]. QuantResultTensorType with its type's shape field modified to use batch_size. .. py:data:: dummy_quant_result_tensor_type .. py:function:: is_dummy_type(t: afe.ir.tensor_type.TensorType) -> bool .. py:class:: AwesomeCalibAttrs Calibration attributes :param observer: Observer used during calibration of the node. If the node does not use calibration data for calculation of quantization parameters, observer will not be created and its value will be None. :param intermediate_observers: Observers used for quantization of intermediate results. :param quant: Quantization scale of the output. It is assigned during quantization. :param input_quant: Quantization scale of each input. During quantization, it is first assigned the type and quantization scale that were determined at the nodes that compute the inputs. Then, when the node is quantized, it is assigned the types and quantization scales of inputs that the node accepts. .. py:attribute:: observer :type: Optional[afe.ir.node_observer.NodeObserver] :value: None .. py:attribute:: intermediate_observers :type: Optional[Dict[str, afe.ir.node_observer.NodeObserver]] :value: None .. py:attribute:: quant :type: afe.ir.defines.DataValue[QuantResultTensorType] .. py:attribute:: input_quant :type: Dict[afe.ir.defines.InputName, afe.ir.defines.DataValue[QuantResultTensorType]] .. py:attribute:: precomputed_quant :type: Optional[afe.ir.defines.Quantization] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: AwesomeQuantAttrBase Base class of quantized operator attributes. This class is used for instance checking only. .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. Should be implemented separately inside each class that inherits from AwesomeQuantAttrBase. .. py:class:: PlaceholderQuantAttrs Properties of a quantized placeholder. :param type: Type of the placeholder's output. :param quantization: Quantization of the placeholder, if it was quantized by the Quantize compiler pass. .. py:attribute:: type :type: afe.ir.tensor_type.TensorType .. py:attribute:: quantization :type: Optional[afe.ir.defines.Quantization] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ConstantQuantAttrs :param quant_data: Quantized tensor value .. py:attribute:: quant_data :type: numpy.ndarray .. py:class:: ConcatQuantAttrs Contains quantization attributes for concatenate quantization. :param input_scale_corrections: Quantized scale correction for each inputs. :param input_zp_corrections: Quantized zero point correction for each inputs. :param right_shift: Number of bits in right shift during requantize at inference time. :param layer_bits: Number of bits used for quantizing the tensor. :param axis: The axis along which the tensors are concatenated. :param node_zps: Zero points(s) of the quantized output tensors(s) :param input_scales: Quantized scale for eash inputs. :param node_scales: Using the max input_scales as the concatenate output scale of the quantized output tensors(s). .. py:attribute:: input_scale_corrections :type: List[int] :value: [] .. py:attribute:: input_zp_corrections :type: List[int] :value: [] .. py:attribute:: right_shifts :type: List[int] :value: [] .. py:attribute:: layer_bits :type: List[int] :value: [8] .. py:attribute:: axis :type: Optional[int] :value: None .. py:attribute:: input_scales :type: Optional[List[Union[float, List[float]]]] :value: [] .. py:attribute:: node_scales :type: Optional[List[float]] :value: [] .. py:attribute:: node_zps :type: Optional[List[int]] :value: None .. py:attribute:: rounding_type :type: ml_kernels.math_helpers.RoundType .. py:class:: MultiplyQuantAttrs param lhs_input_shape: Lhs input shape param rhs_input_shape: Rhs input shape :param input_int16: If True, the inputs have int16 type. If false, the inputs have int8 type. :param intrinsic_shift: Right-shift to apply before requantization. param requant Requantization parameters param lhs_zero_point: Zero point of the left-hand side input. param rhs_zero_point: Zero point of the right-hand side input. param layer_bits: Number of bits used to quantize output tensor. .. py:attribute:: lhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: rhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_int16 :type: bool .. py:attribute:: intrinsic_shift :type: int .. py:attribute:: requant :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: lhs_zero_point :type: int :value: 0 .. py:attribute:: rhs_zero_point :type: int :value: 0 .. py:attribute:: layer_bits :type: int :value: 8 .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LeakyReluQuantAttrs The slope for quantized_intput < zero_point is (alpha >> right_shift) .. py:attribute:: alpha :type: int .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: right_shift :type: int .. py:attribute:: zero_point :type: int .. py:attribute:: bits :type: int .. py:attribute:: rounding_type :type: ml_kernels.math_helpers.RoundType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: AwesomeAttributes A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. Should be implemented separately inside each class that inherits from AwesomeAttributes. .. py:class:: PlaceholderAttrs Properties of a placeholder. .. py:attribute:: type :type: afe.ir.tensor_type.TensorType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ConstantAttrs :param data: Tensor value before quantization .. py:attribute:: data :type: numpy.ndarray .. py:class:: MultiplyAttrs Attributes of a multiply operator. :param scalar_type: Type of input and output. Must be a floating-point type. :param lhs_input_shape: Shape of first input. :param rhs_input_shape: Shape of second input. .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: lhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: rhs_input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:function:: convolution_output_shape(conv_attrs: ConvAttrs) -> tuple[int, Ellipsis] Get the shape of a convolution's output tensor based on its attributes. .. py:class:: ConvAttrs Attributes of a convolution operation. The attributes describe a convolution with input and output activations in NWC, NHWC, or NDHWC layout and weights in WIGO, HWIGO, or DHWIGO layout. The dimension order for 1, 2, or 3 spatial dimensions respectively is W, HW, or DHW. :param stride: Stride in each spatial dimension :param dilation: Dilation in each spatial dimension :param padding: Padding in each spatial dimension. The padding in each dimension is a tuple holding the padding width at the beginning and end of the dimension. :param output_padding: Padding of the output tensor in each spatial dimension for transposed convolution. If it is not a transposed convolution, all padding values must be zero. If it is a transposed convolution, the first element of the padding must be zero. :param is_transposed: Whether it is a transposed convolution. :param weight_shape: Shape of the weight tensor in spatial dimensions ++ IGO layout, for example HWIGO. IGO is an abbreviation for "input channels, groups, output channels". :param input_spatial_shape: Shape of the input tensor in spatial dimensions. :param batch_size: Batch size. :param input_type: Scalar type of the convolution's input tensor. This type is ignored for quantized convolutions. .. py:attribute:: stride :type: tuple[int, Ellipsis] .. py:attribute:: dilation :type: tuple[int, Ellipsis] .. py:attribute:: padding :type: tuple[tuple[int, int], Ellipsis] .. py:attribute:: output_padding :type: tuple[tuple[int, int], Ellipsis] .. py:attribute:: is_transposed :type: bool .. py:attribute:: weight_shape :type: tuple[int, Ellipsis] .. py:attribute:: input_spatial_shape :type: tuple[int, Ellipsis] .. py:attribute:: batch_size :type: int .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:property:: groups :type: int Get the number of convolution groups. .. py:property:: channels :type: int Get the number of convolution output channels. .. py:property:: input_channels :type: int Get the number of convolution input channels. .. py:property:: kernel_size :type: tuple[int, Ellipsis] Get the shape of the convolution kernel in the spatial dimensions. .. py:property:: num_spatial_dimensions :type: int Get the number of spatial dimensions for this convolution. .. py:property:: input_shape :type: tuple[int, Ellipsis] Get the shape of the convolution's input tensor in NWC, NHWC, or NDHWC layout. .. py:property:: output_shape :type: tuple[int, Ellipsis] Get the shape of the convolution's output tensor in NWC, NHWC, or NDHWC layout. .. py:property:: is_depthwise_one_channel :type: bool Return true if this convolution is a depthwise convolution with equal number of input and output channels. .. py:class:: PoolAttrs :param ceil_mode: Used to take ceil or floor when computing the output shape :param out_layout: Layout of the output. This can be an empty str if layout is the same as data_layout. :param layout: Uses the letters NHWC for BatchNumber, Height, Width, Channels :param padding: ((pad_top, pad_bot), ...) along the dimensions of NHWC according to layout :param pool_size: Size of pooling :param strides: Strides :param dilation: Dilation along the dimensions of NHWC according to data_layout :param scalar_type: Data type of the input and output. .. py:attribute:: ceil_mode :type: int .. py:attribute:: out_layout :type: str .. py:attribute:: layout :type: str .. py:attribute:: padding :type: afe.ir.defines.AwesomePad .. py:attribute:: pool_size :type: afe.ir.defines.AwesomePoolSize .. py:attribute:: strides :type: afe.ir.defines.AwesomeStrides .. py:attribute:: dilation :type: afe.ir.defines.AwesomeDilation .. py:attribute:: input_shape :type: afe.ir.defines.AwesomePoolSize .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: MaxPoolAttrs :param ceil_mode: Used to take ceil or floor when computing the output shape :param out_layout: Layout of the output. This can be an empty str if layout is the same as data_layout. :param layout: Uses the letters NHWC for BatchNumber, Height, Width, Channels :param padding: ((pad_top, pad_bot), ...) along the dimensions of NHWC according to layout :param pool_size: Size of pooling :param strides: Strides :param dilation: Dilation along the dimensions of NHWC according to data_layout :param scalar_type: Data type of the input and output. .. py:class:: AvgPoolAttrs :param count_include_pad: If true, include padding to compute the average. .. py:attribute:: count_include_pad :type: bool .. py:class:: VarianceAttrs .. attribute:: input_data_shape Shape of the input tensor. .. attribute:: mean_shape Shape of the mean input tensor. .. attribute:: scalar_type Scalar type of the input and output. .. attribute:: axis The axes to sum over when computing mean. .. py:attribute:: input_data_shape :type: tuple[int, Ellipsis] .. py:attribute:: mean_shape :type: tuple[int, Ellipsis] .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: axis :type: tuple[int, Ellipsis] .. py:class:: AdaptiveAvgPool2DAttrs :param output_size: tuple of int. optional Output height and width. :param out_layout: Layout of the output. This can be an empty str if layout is the same as data_layout. :param layout: Layout of the input. .. py:attribute:: output_size :type: Tuple[int, Ellipsis] .. py:attribute:: out_layout :type: str .. py:attribute:: layout :type: str .. py:class:: ReluAttrs :param scalar_type: Type of input and output. :param input_shape: Shape of input. .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: AddAttrs Attributes of an add operator. :param scalar_type: Type of input and output. Must be a floating-point type. :param lhs_input_shape: Shape of first input. :param rhs_input_shape: Shape of second input. .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: lhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: rhs_input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: SubtractAttrs Attributes of a subtract operator. :param scalar_type: Type of input and output. Must be a floating-point type. :param lhs_input_shape: Shape of first input. :param rhs_input_shape: Shape of second input. .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: lhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: rhs_input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: BiasAddAttrs :param input_shape: The shape of the input activation tensor :param axis: The axis to add the bias .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: axis :type: int .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ConstantMultiplyAddAttrs(scalar_type: afe.ir.tensor_type.ScalarType, lhs_input_shape: Tuple[int, Ellipsis], rhs_input_shape: Tuple[int, Ellipsis], in1_const_attrs: ConstantAttrs, in2_const_attrs: Optional[ConstantAttrs] = None) Attributes representing the computation (a*c + b*d) for scalar constants c and d. .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: lhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: rhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: in1_const_attrs :type: ConstantAttrs .. py:attribute:: in2_const_attrs :type: Optional[ConstantAttrs] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: MeanAttrs :param axis: Axis or axes along which a mean operation is performed. :param exclude: If `exclude` is true, we use the axes that are NOT in the axis field :param keepdims: If set to true the axes reduces are left with a size of 1 .. py:attribute:: axis :type: List[int] .. py:attribute:: exclude :type: bool .. py:attribute:: keepdims :type: bool .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: MeanQuantAttrs Contains quantization attributes for mean quantization. :param attrs: MeanAttrs used in mean operator. :param node_scales: Scales(s) of the quantized output tensors(s). :param node_zps: Zero points(s) of the quantized output tensors(s). .. py:attribute:: attrs :type: MeanAttrs .. py:attribute:: node_scales :type: float :value: 1.0 .. py:attribute:: node_zps :type: int :value: 0 .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ArgMaxAttrs :param axis: Axis or axes along which a mean operation is performed. :param exclude: If `exclude` is true, we use the axes that are NOT in the axis field :param keepdims: If set to true the axes reduces are left with a size of 1 :param select_last_index: Whether to select the last index or the first index if the max element appears in multiple indices. :param shape: Shape of input tensor :param result_scalar_type: Type of numbers in result tensor. It must be either ScalarType.int32 or the same as the input tensor's type. :param input_scalar_type: Type of input values. It must be either ScalarType.float32 or ScalarType.int8. .. py:attribute:: axis :type: List[int] .. py:attribute:: exclude :type: int .. py:attribute:: keepdims :type: int .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:attribute:: select_last_index :type: bool .. py:attribute:: result_scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: input_scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LayerNormAttrs :param axis: The axis to sum over when computing mean. :param input_shape: Shape of input tensor. :param epsilon: The epsilon value to use to avoid division by zero. :param scalar_type: Type of input and output. .. py:attribute:: axis :type: int | tuple[int, int] .. py:attribute:: input_shape :type: tuple[int, Ellipsis] .. py:attribute:: epsilon :type: float .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: RMSNormAttrs :param input_shape: Shape of input tensor. :param epsilon: The epsilon value to use to avoid division by zero. :param scalar_type: Type of input and output. .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: epsilon :type: float .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: InstanceNormAttrs Instance Normalization operator attributes. .. attribute:: axis The axes to sum over when computing mean. .. attribute:: input_data_shape Shape of the input tensor. .. attribute:: mean_shape Shape of the mean input tensor. .. attribute:: variance_shape Shape of the variance input tensor. .. attribute:: epsilon The epsilon value to use to avoid division by zero. .. attribute:: scalar_type Type of input and output. .. py:attribute:: axis :type: tuple[int, int] .. py:attribute:: input_data_shape :type: tuple[int, Ellipsis] .. py:attribute:: mean_shape :type: tuple[int, Ellipsis] .. py:attribute:: variance_shape :type: tuple[int, Ellipsis] .. py:attribute:: epsilon :type: float .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: SoftmaxAttrs :param axis: The axis to sum over when computing softmax :param input_shape: Shape of input tensor :param scalar_type: Type of input and output .. py:attribute:: axis :type: int .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: PadAttrs :param pad_mode: 'constant', 'edge', 'reflect' :param pad_width: padding along each input dimension N in the format of (before_N, after_N) .. py:attribute:: pad_mode :type: str .. py:attribute:: pad_width :type: afe.ir.defines.AwesomePad .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LRNAttrs :param alpha: The scaling parameter. :param axis: Input data layout channel axis. Default value is 1 for NCHW format :param beta: The exponent parameter. :param bias: The offset parameter to avoid dividing by 0. :param size: The size of the local region to be considered for normalization. :param shape: Shape of input tensor # NOTES FOR TENSORFLOW # TVM defines size as size_tvm = (depth_radius_tf * 2) + 1 # TVM defines alpha as alpha_tvm = alpha_tf * size_tf .. py:attribute:: alpha :type: float .. py:attribute:: axis :type: int .. py:attribute:: beta :type: float .. py:attribute:: bias :type: float .. py:attribute:: size :type: int .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ClipAttrs Attributes for Clip operation. Clip operation is always merged into a composite operator. Same class is used in floating-point and quantized version. :param a_min: min value of clip :param a_max: max calue of clip :param shape: Shape of input tensor .. py:attribute:: a_min :type: float .. py:attribute:: a_max :type: float .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ExtmAttrs Attributes for extremum op, can be min or max op depending on the max boolean. :param axis: Axis or axes along which a mean operation is performed. :param exclude: If `exclude` is true, we use the axes that are NOT in the axis field :param keepdims: If set to true the axes reduces are left with a size of 1 :param max: If true the operation is max, if false the operation is min. .. py:attribute:: axis :type: List[int] .. py:attribute:: exclude :type: int .. py:attribute:: keepdims :type: int .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:attribute:: max :type: bool .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: SumAttrs :param axis: Axis or axes along which a mean operation is performed. :param exclude: If `exclude` is true, we use the axes that are NOT in the axis field :param keepdims: If set to true the axes reduces are left with a size of 1 :param num_element: Number of element to be summed. This attribute is not a default TVM attribute. It will be assigned during any floating point inference and used in quantization. .. py:attribute:: axis :type: List[int] .. py:attribute:: exclude :type: int .. py:attribute:: keepdims :type: int .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:attribute:: num_element :type: int .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ProdAttrs :param axis: Axis or axes along which a mean operation is performed. :param exclude: If `exclude` is true, we use the axes that are NOT in the axis field :param keepdims: If set to true the axes reduces are left with a size of 1 .. py:attribute:: axis :type: List[int] .. py:attribute:: exclude :type: int .. py:attribute:: keepdims :type: int .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: FullAttrs :param shape: The shape of the target. :param dtype: The data type of the target. .. py:attribute:: shape :type: List[int] .. py:attribute:: dtype :type: str .. py:class:: TileAttrs :param reps: The number of times repeating the tensor data. .. py:attribute:: reps :type: List[int] .. py:class:: UpsamplingAttrs :param input_shape: Shape of the input tensor. :param scale_h: The scale factor for height upsampling. :param scale_w: The scale factor for width upsampling. :param layout: Layout of the input. :param method: Scale method to used [nearest_neighbor, bilinear, bicubic]. :param align_corners: Whether to keep corners in proper place. :param scalar_type: Data type. .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: scale_h :type: int .. py:attribute:: scale_w :type: int .. py:attribute:: layout :type: str .. py:attribute:: method :type: str .. py:attribute:: align_corners :type: bool .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ImageResize2DAttrs :param size: The out size to which the image will be resized. :param roi: The region of interest for cropping the input image. Expected to be of size 4 and format [start_h, start_w, end_h, end_w]. Only used if coordinate transformation_mode is 'tf_crop_and_resize'. :param layout: Layout of the input. :param method: Scale method to used [nearest_neighbor, linear, bicubic]. :param coordinate_transformation_mode: Describes how to transform the coordinate in the resized tensor to the coordinate in the original tensor. Refer to the ONNX Resize operator specification for details. [half_pixel, align_corners, asymmetric] :param rounding_method: (string, optional) - Indicates how to find the “nearest” pixel in nearest_neighbor method [round, floor, ceil] :param cubic_alpha: (float) – Spline Coefficient for Bicubic Interpolation :param cubic_exclude: (int) – Flag to exclude exterior of the image during bicubic interpolation :param extrapolation_value: Fill value to use when roi is outside of the image. :param out_dtype: Type to return. If left None returns the same type as input. .. py:attribute:: size :type: List[int] .. py:attribute:: roi :type: Tuple[float] .. py:attribute:: layout :type: str .. py:attribute:: method :type: str .. py:attribute:: coordinate_transformation_mode :type: str .. py:attribute:: rounding_method :type: str .. py:attribute:: cubic_alpha :type: float .. py:attribute:: cubic_exclude :type: int .. py:attribute:: extrapolation_value :type: float .. py:attribute:: out_dtype :type: str .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: GridSampleAttrs Attributes of GridSample operator. input_shape: Shape of the input tensor. grid_shape: Shape of the grid tensor. method: Interpolation method to use ["nearest", "bilinear", "bicubic"]. padding_mode: padding mode ["zeros", "border", "reflection"]. align_corners: Whether to align the corners in interpolation. scalar_type: Data type. .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: grid_shape :type: Tuple[int, Ellipsis] .. py:attribute:: method :type: str .. py:attribute:: padding_mode :type: str .. py:attribute:: align_corners :type: bool .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: MaximumAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: MinimumAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: TensorManipulationBaseAttrs Do nothing. Used for better structuring data structure .. py:class:: TupleAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: input_types :type: List[afe.ir.tensor_type.TensorType] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: TupleGetItemAttrs :param input_types: List of input tensor types :param index: The index of the tuple_value we return .. py:attribute:: input_types :type: List[afe.ir.tensor_type.TensorType] .. py:attribute:: index :type: int .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: SqueezeAttrs :param axis: Set of axes to remove :param input_shape: Shape of input tensor :param input_type: Data type of input tensor .. py:attribute:: axis :type: List[int] .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ConcatenateAttrs :param scalar_type: Scalar tyoe of the output. :param axis: The axis along which the tensors are concatenated. :param input_types: List of input tensor types. .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: axis :type: int .. py:attribute:: input_types :type: List[afe.ir.tensor_type.TensorType] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: TransposeAttrs :param axes: The target axes order, reverse order if not specified. :param input_shape: Shape of input tensor :param input_type: Data type of input tensor .. py:attribute:: axes :type: List[int] .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: DepthToSpaceAttrs Attributes of DepthToSpace operator block_size: Bolck size that is shifted from channels to height and width mode: DCR for depth-column-row order re-arrangement, CRD for column-row-depth order input_shape: Shape of input tensor input_type: Data type of input tensor .. py:attribute:: block_size :type: int .. py:attribute:: mode :type: str .. py:attribute:: input_shape :type: tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ReshapeAttrs :param input_shape: Shape of input tensor :param dtype: Data type :param newshape: The new shape. .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: dtype :type: afe.ir.tensor_type.ScalarType .. py:attribute:: newshape :type: List[int] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ExpandDimsAttrs :param axis: The axis that is expanded :param num_newaxis: The number of axes to be inserted. Should be >= 0 :param input_shape: Shape of input tensor :param input_type: Data type of input tensor .. py:attribute:: axis :type: int .. py:attribute:: num_newaxis :type: int .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: BatchFlattenAttrs Do nothing. Used for better structuring data structure .. py:class:: SplitAttrs :param indices_or_sections: Indices or sections to split into. Accepts an int or a tuple If indices_or_sections is an integer, the input will be divided equally along given axis. If such a split is not possible, an error is raised. If indices_or_sections is a tuple of sorted integers, the entries indicate where along axis the array is split. :param axis: The axis over which to split. :param input_shape: Shape of input tensor :param input_type: Data type of input tensor .. py:attribute:: indices_or_sections :type: Union[int, Tuple[int, Ellipsis]] .. py:attribute:: axis :type: int .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: TakeAttrs :param axis: The axis over which to select values. By default, the flattened input array is used. :param mode: Specifies how out-of-bound indices will behave [clip, wrap, fast]. clip: clip to the range (default). wrap: wrap around the indices. fast: no clip or wrap around (user must make sure indices are in-bound). .. py:attribute:: axis :type: int .. py:attribute:: batch_dims :type: int .. py:attribute:: mode :type: str .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: indices_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: StridedSliceAttrs :param begin: The indices to begin with in the slicing. :param end: Indices indicating end of the slice. :param strides: Specifies the stride values, it can be negative in that case, the input tensor will be reversed in that particular axis. :param axes: Tuple[int] or List[int], optional. Axes along which slicing is applied. When it is specified, the length of begin, end, strides, and axes must be equal. Moreover, begin, end, strides, and axes must be static (cannot be relay.Expr). Axes argument for dynamic parameter slicing is not supported yet. :param slice_mode: The slice mode [end, size]. end: The ending indices for the slice [default]. size: The input strides will be ignored, input end in this mode indicates the size of a slice starting at the location specified by begin. If end[i] is -1, all remaining elements in that dimension are included in the slice. :param input_shape: Shape of input tensor :param input_type: Data type of input tensor .. py:attribute:: begin :type: List[int] .. py:attribute:: end :type: List[int] .. py:attribute:: strides :type: List[int] .. py:attribute:: axes :type: Optional[Union[Tuple[int], List[int]]] .. py:attribute:: slice_mode :type: str .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LayoutTransformAttrs :param input_type: Shape and data type of input tensor :param src_layout: The source layout. (e.g NCHW) :param dst_layout: The destination layout. (e.g. NCHW16c) :param implicitly_removable: Whether this transform can be removed from the beginning or end of a model. If the field is True, transform can be removed in order to convert a model's input and output data layout to NHWC (although the removal is done regardless of the actual data layout). Does not affect other optimizations that change or remove layout_transform operators. .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:attribute:: src_layout :type: str .. py:attribute:: dst_layout :type: str .. py:attribute:: implicitly_removable :type: bool :value: False .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: BroadcastToAttrs Do nothing. Used for better structuring data structure .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:attribute:: output_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: TessellationTransformAttrs :param slice_shape: Shape of slice in tessellation :param align_c16: Flag to force 16-channel alignment in tessellation :param cblock: Flag to interleave the 16-channel blocks in tessellation :param frame_type: Tensor type before tessellation .. py:attribute:: slice_shape :type: Sequence[int] .. py:attribute:: align_c16 :type: bool .. py:attribute:: cblock :type: bool .. py:attribute:: frame_type :type: afe.ir.tensor_type.TensorType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: DetessellationTransformAttrs :param slice_shape: Shape of slice in de-tessellation :param align_c16: Flag to indicate that channels are aligned to 16 in tessellated slice. :param cblock: Flag to indicate that tesseallated slice is interleaved by channel blocks. :param frame_type: Tensor type after de-tessellation :param input_shape: Shape of input tensor .. py:attribute:: slice_shape :type: Sequence[int] .. py:attribute:: align_c16 :type: bool .. py:attribute:: cblock :type: bool .. py:attribute:: frame_type :type: afe.ir.tensor_type.TensorType .. py:attribute:: input_shape :type: Tuple[int] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: PackTransformAttrs :param input_shapes: List of input tensor shape tuples :param result_scalar_type: Type of numbers in result tensor, must be ScalarType.int8 .. py:attribute:: input_shapes :type: List[afe.ir.tensor_type.TensorType] .. py:attribute:: result_scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: UnpackTransformAttrs :param input_shape: Shape of input tensor :param tensor_types: List of target tensor types to unpack .. py:attribute:: input_shape :type: Tuple[int] .. py:attribute:: tensor_types :type: List[afe.ir.tensor_type.TensorType] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: NormalizationTransformAttrs :param channel_params: The list of tuples for (divisor, mean, standard deviation) :param input_type: Type and shape of input tensor .. py:attribute:: channel_params :type: List[Tuple[float, float, float]] .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: QuantizationTransformAttrs :param channel_params: The list of tuples for (quant_scale, zero_point) Length of the list can be 1 for per tensor quantization or equal to the number of channels of input_shape for per channel quantization. :param input_shape: Shape of input tensor, expected to be channel last :param num_bits: The number of bits used for quantization :param rounding: The rounding type for quantization :param output_data_type: If number of bits is 8 data type is int8 otherwise int32. .. py:attribute:: channel_params :type: List[Tuple[float, int]] .. py:attribute:: input_shape :type: Tuple[int, int, int, int] .. py:attribute:: num_bits :type: Optional[int] :value: 8 .. py:attribute:: rounding :type: ml_kernels.math_helpers.RoundType .. py:attribute:: output_data_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: DequantizationTransformAttrs :param channel_params: The list of tuples for (quant_scale, zero_point) Length of the list can be 1 for per tensor quantization or equal to the number of channels of input_shape for per channel quantization. :param input_type: Type and shape of input tensor, expected to be channel last. :param output_type: Type of output tensor. .. py:attribute:: channel_params :type: List[Tuple[float, int]] .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:attribute:: output_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ResizeTransformAttrs :param target_height: Target height of resized tensor :param target_width: Target width of resized tensor :param keep_aspect: Boolean flag to keep aspect ratio :param deposit_location: Enum to indicate deposit position of resized image :param method: Enum to indicate supported interpolation methods :param input_type: Input tensor shape and scalar type .. py:attribute:: target_height :type: int .. py:attribute:: target_width :type: int .. py:attribute:: keep_aspect :type: bool .. py:attribute:: deposit_location :type: afe.apis.defines.ResizeDepositLocation .. py:attribute:: method :type: afe.apis.defines.ResizeMethod .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ChromaUpsampleTransformAttrs :param frame_height: Height of full sampling frame :param frame_width: Width of full sampling frame :param yuv_sampling: Chroma sampling Enum .. py:attribute:: frame_height :type: int .. py:attribute:: frame_width :type: int .. py:attribute:: yuv_sampling :type: afe.apis.defines.ChromaSampling .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: YuvRgbConversionTransformAttrs :param conversion: Direction of conversion between YUV and RGB :param std: Standard for color space conversion .. py:attribute:: conversion :type: afe.apis.defines.ColorConversion .. py:attribute:: std :type: afe.apis.defines.ColorSpaceStandard .. py:attribute:: input_shape :type: Tuple[int, int, int, int] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: BgrRgbConversionTransformAttrs :param conversion: Direction of conversion between BGR and RGB .. py:attribute:: conversion :type: afe.apis.defines.ColorConversion .. py:attribute:: input_shape :type: Tuple[int, int, int, int] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: SigmoidTransformAttrs :param save_int16: Boolean flag to save output as 16-bit fixed point .. py:attribute:: save_int16 :type: bool .. py:attribute:: input_shape :type: Tuple[int, int, int, int] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: NmsMaxpoolTransformAttrs :param kernel: Size of pooling kernel .. py:attribute:: kernel :type: int .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: CastAttrs :param out_dtype: The data type of the target. :param input_shape: Shape of input tensor. .. py:attribute:: out_dtype :type: str .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: UDFAttrs Common attributes for UDF functions: * Sqrt * Rsqrt * Sigmoid * Exp * Tanh * log, log2, log10 .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LeakyReluAttrs :param alpha: The slope for the small gradient when x < 0 .. py:attribute:: alpha :type: float .. py:class:: SwishAttrs Common attributes for UDF functions: * Sqrt * Rsqrt * Sigmoid * Exp * Tanh * log, log2, log10 .. py:class:: PReluAttrs :param scalar_type: Type of input and output. Must be a floating-point type. :param axis: The axis channel dimension is specified. :param alpha: The slope for the small gradient when x < 0 (constant tensor) :param input_shape: Shape of input. .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:attribute:: axis :type: int .. py:attribute:: alpha :type: numpy.ndarray .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ClipQuantAttrs Attributes for Clip operation. Clip operation is always merged into a composite operator. Same class is used in floating-point and quantized version. :param a_min: min value of clip :param a_max: max calue of clip :param shape: Shape of input tensor .. py:attribute:: a_min :type: int .. py:attribute:: a_max :type: int .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ReluQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: zero_point :type: int :value: 0 .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:data:: ACTIVATION_ATTRS .. py:data:: QUANT_ACTIVATION_ATTRS .. py:class:: AddActivationAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: add_attrs :type: AddAttrs .. py:attribute:: activ_attrs :type: Optional[ACTIVATION_ATTRS] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ConvAddActivationAttrs Attributes of a fused convolution operator consisting of convolution, optional bias-add, and optional activation function. .. py:attribute:: weights_attrs :type: ConstantAttrs .. py:attribute:: conv_attrs :type: ConvAttrs .. py:attribute:: bias_attrs :type: Optional[ConstantAttrs] :value: None .. py:attribute:: add_attrs :type: Optional[Union[AddAttrs, BiasAddAttrs]] :value: None .. py:attribute:: activ_attrs :type: Optional[ACTIVATION_ATTRS] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: TupleConcatenateAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: tuple_attrs :type: TupleAttrs .. py:attribute:: concat_attrs :type: ConcatenateAttrs .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ExternalAttrs :param external_input_list: Parameter names of the external code. This list must be equal to list(node_type.keys()). :param node_type: The external operation's type. :param backend: The build target. :param irmod_str: The TVM IRModule of the external code saved in string form. Code representations in other fields are derived from this one. It has batch size 1, regardless of batch_size. :param operations: A list of strings that detail the ops that are contained within the IRModule. :param _graph_module: Lazily compiled executable representation of the external code. This module is used for executing this node on the compilation host. :param batch_size: The batch size that this node handles. .. py:attribute:: external_input_list :type: List[str] .. py:attribute:: node_type :type: afe.ir.tensor_type.NodeType .. py:attribute:: backend :type: str .. py:attribute:: irmod_str :type: str .. py:attribute:: operations :type: List[str] .. py:attribute:: batch_size :type: int :value: 1 .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:property:: graph_module :type: afe._tvm._defines.TVMGraphModule Get the operator's code as a TVM module that can run on the compilation host. :return: TVM Graph module .. py:class:: QNNQuantizeAttrs Further reference: tvm/src/relay/qnn/op/quantize.cc :param out_dtype: Specifies the output data type. :param axis: The channel axis for quantization. :param input_type: Tensor input type. .. py:attribute:: out_dtype :type: str .. py:attribute:: axis :type: int .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:attribute:: output_scale :type: numpy.ndarray .. py:attribute:: output_zero_point :type: numpy.ndarray .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: QNNDequantizeAttrs Further reference: tvm/src/relay/qnn/op/dequantize.cc :param axis: The channel axis for quantization. .. py:attribute:: axis :type: int .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:attribute:: input_scale :type: numpy.ndarray .. py:attribute:: input_zero_point :type: numpy.ndarray .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: RequantizeAttrs Further reference: tvm/src/relay/qnn/op/requantize.cc :param axis: The channel axis for quantization. This axis only apply to the input :param rounding: Defines the rounding direction when the value is midway between two representable values. :param compute_dtype: Specifies the data type used during requantize. Supported options: "int64", "float32", "float64" :param out_dtype: Specifies the output data type. .. py:attribute:: axis :type: int .. py:attribute:: rounding :type: str .. py:attribute:: compute_dtype :type: str .. py:attribute:: out_dtype :type: str .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: CustomOpAttrs Custom Op AwesomeAttributes :param custom_op_attrs: Union[str, Dic[str, Union[str, bool]]]. Custom op attrs in either str format or a dictionary :param c_code_in_dtypes: Optional[List[str]]. Input tensors' dtypes. This attribute will be assigned at the runtime :param c_code_in_shapes: Optional[List[Tuple[int, ...]]]. Input tensors' shapes This attribute will be assigned at the runtime :param function: Optional[OperatorFunction]. Compiled custom op C function This attribute will be assigned at the runtime :param args_list: Optional[Any]. A list of arguments for the custom op C function. This attribute will be assigned at the runtime .. py:attribute:: output_types :type: List[afe.ir.tensor_type.TensorType] .. py:attribute:: custom_op_attrs :type: Union[str, Dict[str, Union[str, bool]]] .. py:attribute:: c_code_in_dtypes :type: Optional[List[str]] :value: None .. py:attribute:: c_code_in_shapes :type: Optional[List[Tuple[int, Ellipsis]]] :value: None .. py:attribute:: function :type: Optional[ml_kernels.c_function_call_helpers.OperatorFunction] :value: None .. py:attribute:: args_list :type: Optional[Any] :value: None .. py:class:: AddQuantAttrs Attributes for quantized AddActivationOp. param lhs_scale: Scale correction applied to the left-hand side input. param rhs_scale: Scale correction applied to the right-hand side input. :param input_int16: If True, the inputs have int16 type. If false, the inputs have int8 type. :param requant: Requantization to perform on the output. :param relu_zero_point: Zero point of the output for relu activation. Ignored if relu is not used. param layer_bits: Number of bits used to quantize output tensor. param activ_attrs: Activation attributes used in Add composite operators. .. py:attribute:: lhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: rhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_int16 :type: bool .. py:attribute:: requant :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: relu_zero_point :type: int :value: 0 .. py:attribute:: lhs_scale :type: int :value: 1 .. py:attribute:: rhs_scale :type: int :value: 1 .. py:attribute:: layer_bits :type: int :value: 8 .. py:attribute:: activ_attrs :type: Optional[QUANT_ACTIVATION_ATTRS] :value: None .. py:property:: node_scales :type: List[float] .. py:property:: node_zps :type: List[int] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: SubtractQuantAttrs param attrs: SubtractAttrs class holding SubtractOp parameters :param input_int16: If True, the inputs have int16 type. If False, the inputs have int8 type. param lhs_scale: Scale correction applied to the left-hand side input. param rhs_scale: Scale correction applied to the right-hand side input. param layer_bits: Number of bits used to quantize output tensor. .. py:attribute:: attrs :type: SubtractAttrs .. py:attribute:: input_int16 :type: bool .. py:attribute:: requant :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: lhs_scale :type: int :value: 1 .. py:attribute:: rhs_scale :type: int :value: 1 .. py:attribute:: layer_bits :type: int :value: 8 .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ConvQuantAttrs Used for all variants of convolution. The attributes describe the following sequence of operators (some are optional). Relu and clip are mutually exclusive. 1. convolution 2. bias_add 3. requantize 4. relu/clip Due to limitations of how the backend is implemented, we cannot allow the combination zero_point != 0 and isinstance(activ_attrs, ReluAttrs) and isinstance(requant, ArithFoldedRequantization). The quantizer must conform to this restriction. :param conv_attrs: Attributes of the convolution operator. :param weight_quant_data: Quantized weights data. :param scale: Scale of the convolution operation. :param zero_point: Zero point of the quantized output tensor. :param input_zp: Zero point of input to the convolution. :param bias_quant_data: Quantized bias data. :param weight_bits: Number of bits used to quantize the weights. :param bits: Number of bits used for quantization. :param per_channel: If true, each output channel of the weights will have an independent scale. :param activ_attrs: Activation attributes. :param requant: Requantization to do after convolve and add. :param input_int16: Whether the input tensor has int16 type. If true, then the operator will execute using the 15-bit convolution algorithm. :param msb_left_shift: Whether the 15-bit convolution algorithm will left-shift the MSB (effectively right-shifting the full product by 1). If false, it will right-shift the LSB (effectively right-shifting the full product by 8). Ignored if input_int16 is False. .. py:attribute:: conv_attrs :type: ConvAttrs .. py:attribute:: weight_quant_data :type: numpy.ndarray .. py:attribute:: requant :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: scale :type: float :value: 1.0 .. py:attribute:: zero_point :type: int :value: 0 .. py:attribute:: input_zp :type: int :value: 0 .. py:attribute:: bias_quant_data :type: Optional[numpy.ndarray] :value: None .. py:attribute:: per_channel :type: bool :value: False .. py:attribute:: activ_attrs :type: Optional[QUANT_ACTIVATION_ATTRS] :value: None .. py:attribute:: input_int16 :type: bool :value: False .. py:attribute:: msb_left_shift :type: Union[bool, numpy.ndarray] :value: True .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: UpsamplingQuantAttrs :param input_zp: :param rounding_type: .. py:attribute:: upsampling_attrs :type: UpsamplingAttrs .. py:attribute:: input_zp :type: int :value: 0 .. py:attribute:: input_scale :type: float :value: 1.0 .. py:attribute:: rounding_type :type: ml_kernels.math_helpers.RoundType .. py:attribute:: input_int16 :type: bool :value: False .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ImageResize2DQuantAttrs :param input_zp: :param rounding_type: :param requant: Requantization to perform on the output. :param input_int16: If True, the inputs have int16 type. If False, the inputs have int8 type. .. py:attribute:: image_resize2d_attrs :type: ImageResize2DAttrs .. py:attribute:: input_int16 :type: bool :value: False .. py:attribute:: input_zp :type: int :value: 0 .. py:attribute:: input_scale :type: float :value: 1.0 .. py:attribute:: rounding_type :type: ml_kernels.math_helpers.RoundType .. py:attribute:: requant :type: Optional[ml_kernels.requantization.BaseRequantization] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LRNQuantAttrs :param axis: Input data layout channel axis. Default value is 1 for NCHW format :param size: The size of the local region to be considered for normalization. :param lut_scale: The scale for quantization of LUT input . :param lut_zp_corr: The zp correction for quantization of LUT input . :param lut_sh: The shift for quantization of LUT input . :param output_scale: The scale for quantization of output. :param output_zp_corr: The zp correction for quantization of output. :param output_sh: The shift for quantization of output. # NOTES FOR TENSORFLOW # TVM defines size as size_tvm = (depth_radius_tf * 2) + 1 # TVM defines alpha as alpha_tvm = alpha_tf * size_tf .. py:attribute:: axis :type: int .. py:attribute:: size :type: int .. py:attribute:: shape :type: Tuple[int, Ellipsis] .. py:attribute:: input_zp :type: int .. py:attribute:: lut_scale :type: int .. py:attribute:: lut_zp_corr :type: int .. py:attribute:: lut_sh :type: int .. py:attribute:: output_scale :type: int .. py:attribute:: output_zp_corr :type: int .. py:attribute:: output_sh :type: int .. py:attribute:: lookup_table :type: numpy.ndarray .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LayerNormQuantAttrs :param axis: Indicates the dimension along which LayerNorm will be performed. :param input_shape: Input shape. :param lookup_table_rsqrt: Look-up table f(x) = 1 / sqrt(x + epsilon). :param zp_rsqrt: Output zero point of the Rsqrt LUT. :param requant_mean: Requantization parameters for input mean (integer inputs only). :param requant_lut_input: Requantization parameters for Rsqrt LUT input. :param requant_output: Requantization of final output. .. py:attribute:: axis :type: int .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: zp_rsqrt :type: int .. py:attribute:: lookup_table_rsqrt :type: numpy.ndarray .. py:attribute:: requant_mean :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: requant_lut_input :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: requant_output :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: InstanceNormQuantAttrs Quantized Instance Normalization operator attributes. .. attribute:: attrs InstanceNorm attributes. .. attribute:: lut_rsqrt Look-up table f(x) = 1 / sqrt(x + epsilon). .. attribute:: zp_rsqrt Output zero point of the Rsqrt LUT. .. attribute:: requant_out Requantization of the output. .. py:attribute:: attrs :type: InstanceNormAttrs .. py:attribute:: lut_rsqrt :type: numpy.ndarray .. py:attribute:: zp_rsqrt :type: int .. py:attribute:: requant_out :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:class:: RMSNormQuantAttrs :param input_shape: Input shape. :param zp_ifm: Input tensor zero point. :param lookup_table_rsqrt: Look-up table f(x) = 1 / sqrt(x + epsilon). :param zp_rsqrt: Output zero point of the Rsqrt LUT. :param requant_lut_input: Requantization parameters for Rsqrt LUT input. :param requant_output: Requantization of final output. :param lut_input_pre_shift: LUT input requantization pre-shift value. :param output_pre_shift: Output requantization pre-shift value. :param enable_lut_int16: If True, quantize LUT to int16 otherwise to int8. .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: zp_ifm :type: int .. py:attribute:: lookup_table_rsqrt :type: numpy.ndarray .. py:attribute:: zp_rsqrt :type: int .. py:attribute:: requant_lut_input :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: requant_output :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: lut_input_pre_shift :type: int .. py:attribute:: output_pre_shift :type: int .. py:attribute:: enable_lut_int16 :type: bool .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: SoftmaxQuantAttrs :param axis: Input data layout channel axis. :param input_shape: Input shape. :param exp_zp: Exp zero point. :param rec_zp: Rec zero point. :param requant_lut: Requantization parameters for quantization of reciprocal LUT input. :param requant_output: Requantization parameters for output. :param lookup_table_exp: LUT for exponential function. :param lookup_table_rec: LUT for reciprocal function. :param enable_int16: Whether int8 or int16 quantization is used. :param lut_input_pre_shift: LUT input requantization pre-shift value (int16 only). :param output_pre_shift: Output requantization pre-shift value (int16 only). .. py:attribute:: axis :type: int .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: exp_zp :type: int .. py:attribute:: rec_zp :type: int .. py:attribute:: requant_lut :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: requant_output :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:attribute:: lookup_table_exp :type: numpy.ndarray .. py:attribute:: lookup_table_rec :type: numpy.ndarray .. py:attribute:: enable_int16 :type: bool .. py:attribute:: lut_input_pre_shift :type: Optional[int] :value: None .. py:attribute:: output_pre_shift :type: Optional[int] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: RequantizeQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: attrs :type: RequantizeAttrs .. py:attribute:: requant :type: ml_kernels.requantization.BaseRequantization[numpy.ndarray] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ConcatQuantAttrs Contains quantization attributes for concatenate quantization. :param attrs: ConcatenateAttrs holding ConcatenateOp parameters. :param requants: Requantization parameters :param layer_bits: Number of bits used for quantizing the tensor. :param input_scales: Quantized scale for eash inputs. :param node_scales: Using the max input_scales as the concatenate output scale of the quantized output tensors(s). :param node_zps: Zero points(s) of the quantized output tensors(s) .. py:attribute:: attrs :type: ConcatenateAttrs .. py:attribute:: requants :type: List[ml_kernels.requantization.BaseRequantization[numpy.ndarray]] .. py:attribute:: layer_bits :type: List[int] :value: [8] .. py:attribute:: input_scales :type: List[Union[float, List[float]]] :value: [] .. py:attribute:: node_scales :type: List[float] :value: [] .. py:attribute:: node_zps :type: List[int] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: CustomOpQuantAttrs Contains quantization attributes for custom operation quantization. :param custom_op_attrs: CustomOp attributes. :param layer_bits: Number of bits used for quantizing the tensor. :param node_zps: Zero points(s) of the quantized output tensors(s) :param node_scales: Output scale of the quantized output tensors(s). :param input_zps: Quantized zero points correction each input. :param input_scales: Quantized scales for each input. .. py:attribute:: custom_op_attrs :type: CustomOpAttrs .. py:attribute:: layer_bits :type: List[int] :value: [8] .. py:attribute:: node_zps :type: List[int] :value: [] .. py:attribute:: node_scales :type: List[float] :value: [] .. py:attribute:: input_zps :type: List[Union[int, List[int]]] :value: [] .. py:attribute:: input_scales :type: List[Union[float, List[float]]] :value: [] .. py:class:: PoolQuantAttrs Contains quantization attributes for pool quantization. :param pool_attrs: Pool attrs class holding MaxPool/AvgPoll operator parameters. Its scalar type does not determine the scalar type for the quantized operator. :param pad_value: Padding value. :param rounding_type: RoundType. .. py:attribute:: pool_attrs :type: PoolAttrs .. py:attribute:: pad_value :type: Union[float, int] .. py:attribute:: rounding_type :type: ml_kernels.math_helpers.RoundType .. py:attribute:: input_int16 :type: bool .. py:attribute:: requant :type: Optional[ml_kernels.requantization.BaseRequantization] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: VarianceQuantAttrs .. attribute:: attrs Variance attributes. .. attribute:: requant Requantiation of the intermediate values. .. attribute:: requant_var Requantization of the Variance operator final output. .. py:attribute:: attrs :type: VarianceAttrs .. py:attribute:: requant :type: ml_kernels.requantization.BaseRequantization .. py:attribute:: requant_var :type: ml_kernels.requantization.BaseRequantization .. py:class:: UDFQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: attrs :type: UDFAttrs .. py:attribute:: input_signed :type: bool :value: False .. py:attribute:: output_signed :type: bool :value: False .. py:attribute:: lookup_table :type: Optional[numpy.ndarray] :value: None .. py:attribute:: input_int16 :type: bool :value: False .. py:attribute:: requant :type: Optional[ml_kernels.requantization.BaseRequantization] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: DivideAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: udf_attrs :type: UDFAttrs .. py:attribute:: multiply_attrs :type: MultiplyAttrs .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: DivideQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: udf_attrs :type: UDFQuantAttrs .. py:attribute:: multiply_attrs :type: MultiplyQuantAttrs .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: LeakyReluCompositeQuantAttrs Contains quantization attributes for both UDF and breakdown LeakyRelu quantization. :param attrs: LeakyRelu attributes class holding LeakyReluOp parameters. :param leaky_relu_uses_udf: bool. If True, use UDF version in quantization. Otherwise, use breakdown version. :param leaky_relu_quant_attrs: Contains quantization parameters for breakdown version if breakdown version is used. :param udf_quant_attrs: Contains quantization parameters for UDF version if UDF version is used. .. py:attribute:: attrs :type: LeakyReluAttrs .. py:attribute:: leaky_relu_uses_udf :type: bool :value: True .. py:attribute:: leaky_relu_quant_attrs :type: Optional[LeakyReluQuantAttrs] :value: None .. py:attribute:: udf_quant_attrs :type: Optional[UDFQuantAttrs] :value: None .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: PReluQuantAttrs The slope for quantized_intput < zero_point is (alpha >> right_shift) .. py:attribute:: axis :type: int .. py:attribute:: input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: quant_alpha :type: numpy.ndarray .. py:attribute:: alpha_shift :type: int :value: 0 .. py:attribute:: data_zero_point :type: int :value: 0 .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: PowerAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: lhs_input_shape :type: Tuple[int, Ellipsis] .. py:attribute:: rhs_input_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: ArgMaxQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: attrs :type: ArgMaxAttrs .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:class:: BatchMatmulAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: transpose_b :type: bool .. py:attribute:: input_shapes :type: List[Tuple[int, Ellipsis]] .. py:attribute:: scalar_type :type: afe.ir.tensor_type.ScalarType .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. .. py:method:: get_output_shape() -> Tuple[int, Ellipsis] .. py:class:: BatchMatmulQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: attrs :type: BatchMatmulAttrs .. py:attribute:: lhs_zp :type: int .. py:attribute:: rhs_zp :type: int .. py:attribute:: requant :type: ml_kernels.requantization.BaseRequantization .. py:attribute:: intrinsic_shift :type: int .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size. Should be implemented separately inside each class that inherits from AwesomeQuantAttrBase. .. py:class:: SliceConcatAttrs A class that stores attributes necessary for the execution of its associated AwesomeOperation. Subclasses should include all additional attributes in their __init__ functions and call back to the AwesomeAttributes __init__ function to include the default attributes .. py:attribute:: slice_attrs :type: List[StridedSliceAttrs] .. py:attribute:: tuple_concat_attrs :type: TupleConcatenateAttrs .. py:class:: SliceConcatQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: slice_attrs :type: List[StridedSliceAttrs] .. py:attribute:: tuple_concat_attrs :type: ConcatQuantAttrs .. py:class:: BroadcastToQuantAttrs Base class of quantized operator attributes. This class is used for instance checking only. .. py:attribute:: input_type :type: afe.ir.tensor_type.TensorType .. py:attribute:: output_shape :type: Tuple[int, Ellipsis] .. py:method:: set_batch_size(batch_size: int) Modify internal parameters' shapes for the given batch size.