# com.microsoft - QLinearAveragePool#

## QLinearAveragePool - 1 (com.microsoft)#

Version

• domain: com.microsoft

• since_version: 1

• function:

• support_level:

• shape inference:

This version of the operator has been available since version 1 of domain com.microsoft.

Summary

QLinearAveragePool consumes an input tensor X and applies average pooling across the tensor according to kernel sizes, stride sizes, and pad lengths. average pooling consisting of computing the average on all values of a subset of the input tensor according to the kernel size and downsampling the data into the output tensor Y for further processing. The output spatial shape will be following: ```` output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1) ```` or ```` output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1) ```` if ceil_mode is enabled

```` * pad_shape[i] is sum of pads along axis i ````

auto_pad is a DEPRECATED attribute. If you are using them currently, the output spatial shape will be following: ```` VALID: output_spatial_shape[i] = ceil((input_spatial_shape[i] - kernel_spatial_shape[i] + 1) / strides_spatial_shape[i]) SAME_UPPER or SAME_LOWER: output_spatial_shape[i] = ceil(input_spatial_shape[i] / strides_spatial_shape[i]) ```` And pad shape will be following if SAME_UPPER or SAME_LOWER: ```` pad_shape[i] = (output_spatial_shape[i] - 1) * strides_spatial_shape[i] + kernel_spatial_shape[i] - input_spatial_shape[i] ````

The output of each pooling window is divided by the number of elements (exclude pad when attribute count_include_pad is zero).

Input and output scales and zero points are used to convert the output to a new quantization range. Output = Dequantize(Input) -> AveragePool on fp32 data -> Quantize(output)

Attributes

• auto_pad: auto_pad must be either NOTSET, SAME_UPPER, SAME_LOWER or VALID. Where default value is NOTSET, which means explicit padding is used. SAME_UPPER or SAME_LOWER mean pad the input so that the output spatial size match the input.In case of odd number add the extra padding at the end for SAME_UPPER and at the beginning for SAME_LOWER. VALID mean no padding. Default value is `?`.

• ceil_mode: Whether to use ceil or floor (default) to compute the output shape. Default value is `?`.

• channels_last: Works on NHWC layout or not? Default not. Default value is `?`.

• count_include_pad: Whether include pad pixels when calculating values for the edges. Default is 0, doesn’t count include pad. Default value is `?`.

• kernel_shape (required): The size of the kernel along each axis. Default value is `?`.

• pads: Padding for the beginning and ending along each spatial axis, it can take any value greater than or equal to 0. The value represent the number of pixels added to the beginning and end part of the corresponding axis. pads format should be as follow [x1_begin, x2_begin…x1_end, x2_end,…], where xi_begin the number of pixels added at the beginning of axis i and xi_end, the number of pixels added at the end of axis i. This attribute cannot be used simultaneously with auto_pad attribute. If not present, the padding defaults to 0 along start and end of each spatial axis. Default value is `?`.

• strides: Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis. Default value is `?`.

Inputs

Between 4 and 5 inputs.

• X (heterogeneous) - T: Input data tensor from the previous operator; dimensions for image case are (N x C x H x W), where N is the batch size, C is the number of channels, and H and W are the height and the width of the data. For non image case, the dimensions are in the form of (N x C x D1 x D2 … Dn), where N is the batch size. Optionally, if dimension denotation is in effect, the operation expects the input data tensor to arrive with the dimension denotation of [DATA_BATCH, DATA_CHANNEL, DATA_FEATURE, DATA_FEATURE …].

• x_scale (heterogeneous) - tensor(float): Input scale. It’s a scalar, which means a per-tensor/layer quantization.

• x_zero_point (optional, heterogeneous) - T: Input zero point. Default value is 0 if it’s not specified. It’s a scalar, which means a per-tensor/layer quantization.

• y_scale (heterogeneous) - tensor(float): Output scale. It’s a scalar, which means a per-tensor/layer quantization.

• y_zero_point (optional, heterogeneous) - T: Output zero point. Default value is 0 if it’s not specified. It’s a scalar, which means a per-tensor/layer quantization.

Outputs

• Y (heterogeneous) - T: Output data tensor from average or max pooling across the input tensor. Dimensions will vary based on various kernel, stride, and pad sizes. Floor value of the dimension is used

Examples
{"ft_lang_label":"__label__en","ft_lang_prob":0.76611155,"math_prob":0.9618935,"size":4692,"snap":"2022-40-2023-06","text_gpt3_token_len":1118,"char_repetition_ratio":0.15848976,"word_repetition_ratio":0.09537167,"special_character_ratio":0.23444161,"punctuation_ratio":0.13772455,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9909201,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-10-07T13:12:55Z\",\"WARC-Record-ID\":\"<urn:uuid:9246a4f0-7d16-411a-aca8-3d67976acf27>\",\"Content-Length\":\"79868\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:1b9b0590-3711-4c61-b015-d31eabded77c>\",\"WARC-Concurrent-To\":\"<urn:uuid:c76e22d6-89ac-47d8-95a4-d9b05cb3b18f>\",\"WARC-IP-Address\":\"51.159.6.59\",\"WARC-Target-URI\":\"http://xavierdupre.fr/app/onnxcustom/helpsphinx/api/onnxops/onnx_commicrosoft_QLinearAveragePool.html\",\"WARC-Payload-Digest\":\"sha1:3M6HM7H76M3LRVHMZQPHUIPFCDTAWQ4G\",\"WARC-Block-Digest\":\"sha1:4HJRMHTYXE5MD5MD5P7QVYSZF4XV2RHJ\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-40/CC-MAIN-2022-40_segments_1664030338073.68_warc_CC-MAIN-20221007112411-20221007142411-00627.warc.gz\"}"}