.. _op_ai_onnx_AveragePool-10: AveragePool - version 10 ======================== This page documents version **10** of operator **AveragePool**. See :doc:`AveragePool` for the latest version (since version 22). - **Domain**: ``ai.onnx`` - **Since version**: 10 AveragePool 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: .. code-block:: output_spatial_shape[i] = floor((input_spatial_shape[i] + pad_shape[i] - kernel_spatial_shape[i]) / strides_spatial_shape[i] + 1) or .. code-block:: 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 .. code-block:: * 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: .. code-block:: 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``: .. code-block:: 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). **Inputs** - **X** (*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 ...]. **Outputs** - **Y** (*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 **Type Constraints** - **T**: Constrain input and output types to float tensors. Allowed types: tensor(double), tensor(float), tensor(float16). Differences with previous version (7) ------------------------------------- **SchemaDiff**: ``AveragePool`` (domain ``'ai.onnx'``) * old version: 7 * new version: 10 * breaking: no **Documentation:** * line similarity: 0.87 (+7/-0 lines) .. code-block:: diff --- AveragePool v7 +++ AveragePool v10 @@ -6,7 +6,14 @@ 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 ```