(l-onnx-doc-LpPool)=
# LpPool
(l-onnx-op-lppool-22)=
## LpPool - 22
### Version
- **name**: [LpPool (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#LpPool)
- **domain**: `main`
- **since_version**: `22`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `True`
This version of the operator has been available
**since version 22**.
### Summary
LpPool consumes an input tensor X and applies Lp pooling across
the tensor according to kernel sizes, stride sizes, and pad lengths.
Lp pooling consisting of computing the Lp norm 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] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1)
```
or
```
output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1)
```
if ceil_mode is enabled `pad_shape[i]` is the 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] - {kernelSpatialShape} + 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] + {kernelSpatialShape} - input_spatial_shape[i]
```
### Attributes
* **auto_pad - STRING** (default is `'NOTSET'`):
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 `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. The padding is split between the two sides equally or almost equally (depending on whether it is even or odd). In case the padding is an odd number, the extra padding is added at the end for SAME_UPPER and at the beginning for SAME_LOWER.
* **ceil_mode - INT** (default is `'0'`):
Whether to use ceil or floor (default) to compute the output shape.
* **dilations - INTS** :
dilation value along each spatial axis of the filter. If not present, the dilation defaults is 1 along each spatial axis.
* **kernel_shape - INTS** (required) :
The size of the kernel along each axis.
* **p - INT** (default is `'2'`):
p value of the Lp norm used to pool over the input data.
* **pads - INTS** :
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.
* **strides - INTS** :
Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis.
### 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.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor from Lp pooling across the input tensor. Dimensions will vary based on various kernel, stride, and pad sizes.
### Type Constraints
* **T** in ( `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` ):
Constrain input and output types to float tensors.
```{toctree}
text_diff_LpPool_18_22
```
(l-onnx-op-lppool-18)=
## LpPool - 18
### Version
- **name**: [LpPool (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#LpPool)
- **domain**: `main`
- **since_version**: `18`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `True`
This version of the operator has been available
**since version 18**.
### Summary
LpPool consumes an input tensor X and applies Lp pooling across
the tensor according to kernel sizes, stride sizes, and pad lengths.
Lp pooling consisting of computing the Lp norm 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] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1)
```
or
```
output_spatial_shape[i] = ceil((input_spatial_shape[i] + pad_shape[i] - {kernelSpatialShape}) / strides_spatial_shape[i] + 1)
```
if ceil_mode is enabled `pad_shape[i]` is the 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] - {kernelSpatialShape} + 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] + {kernelSpatialShape} - input_spatial_shape[i]
```
### Attributes
* **auto_pad - STRING** (default is `'NOTSET'`):
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 `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. The padding is split between the two sides equally or almost equally (depending on whether it is even or odd). In case the padding is an odd number, the extra padding is added at the end for SAME_UPPER and at the beginning for SAME_LOWER.
* **ceil_mode - INT** (default is `'0'`):
Whether to use ceil or floor (default) to compute the output shape.
* **dilations - INTS** :
dilation value along each spatial axis of the filter. If not present, the dilation defaults is 1 along each spatial axis.
* **kernel_shape - INTS** (required) :
The size of the kernel along each axis.
* **p - INT** (default is `'2'`):
p value of the Lp norm used to pool over the input data.
* **pads - INTS** :
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.
* **strides - INTS** :
Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis.
### 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.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor from Lp pooling across the input tensor. Dimensions will vary based on various kernel, stride, and pad sizes.
### Type Constraints
* **T** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)` ):
Constrain input and output types to float tensors.
```{toctree}
text_diff_LpPool_11_22
text_diff_LpPool_11_18
```
(l-onnx-op-lppool-11)=
## LpPool - 11
### Version
- **name**: [LpPool (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#LpPool)
- **domain**: `main`
- **since_version**: `11`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `True`
This version of the operator has been available
**since version 11**.
### Summary
LpPool consumes an input tensor X and applies Lp pooling across
the tensor according to kernel sizes, stride sizes, and pad lengths.
Lp pooling consisting of computing the Lp norm 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.
### Attributes
* **auto_pad - STRING** (default is `'NOTSET'`):
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 `output_shape[i] = ceil(input_shape[i] / strides[i])` for each axis `i`. The padding is split between the two sides equally or almost equally (depending on whether it is even or odd). In case the padding is an odd number, the extra padding is added at the end for SAME_UPPER and at the beginning for SAME_LOWER.
* **kernel_shape - INTS** (required) :
The size of the kernel along each axis.
* **p - INT** (default is `'2'`):
p value of the Lp norm used to pool over the input data.
* **pads - INTS** :
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.
* **strides - INTS** :
Stride along each spatial axis. If not present, the stride defaults to 1 along each spatial axis.
### 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.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor from Lp pooling across the input tensor. Dimensions will vary based on various kernel, stride, and pad sizes.
### Type Constraints
* **T** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)` ):
Constrain input and output types to float tensors.
```{toctree}
text_diff_LpPool_2_22
text_diff_LpPool_2_18
text_diff_LpPool_2_11
```
(l-onnx-op-lppool-2)=
## LpPool - 2
### Version
- **name**: [LpPool (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#LpPool)
- **domain**: `main`
- **since_version**: `2`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `True`
This version of the operator has been available
**since version 2**.
### Summary
LpPool consumes an input tensor X and applies Lp pooling across
the tensor according to kernel sizes, stride sizes, and pad lengths.
Lp pooling consisting of computing the Lp norm 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.
### Attributes
* **auto_pad - STRING** (default is `'NOTSET'`):
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.
* **kernel_shape - INTS** (required) :
The size of the kernel along each axis.
* **p - INT** (default is `'2'`):
p value of the Lp norm used to pool over the input data.
* **pads - INTS** :
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.
* **strides - INTS** :
Stride along each spatial axis.
### 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.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor from Lp pooling across the input tensor. Dimensions will vary based on various kernel, stride, and pad sizes.
### Type Constraints
* **T** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)` ):
Constrain input and output types to float tensors.
```{toctree}
text_diff_LpPool_1_22
text_diff_LpPool_1_18
text_diff_LpPool_1_11
text_diff_LpPool_1_2
```
(l-onnx-op-lppool-1)=
## LpPool - 1
### Version
- **name**: [LpPool (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#LpPool)
- **domain**: `main`
- **since_version**: `1`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `False`
This version of the operator has been available
**since version 1**.
### Summary
LpPool consumes an input tensor X and applies Lp pooling across the
the tensor according to kernel sizes, stride sizes, and pad lengths.
Lp pooling consisting of computing the Lp norm 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.
### Attributes
* **auto_pad - STRING** (default is `'NOTSET'`):
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 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. DEPRECATION NOTE: auto_pad is only intended to support legacy uses, and for framework authors, one is explicitly encouraged to use explicit padding specified in the pads attribute.
* **kernel_shape - INTS** :
The size of the kernel along each axis.
* **p - FLOAT** (default is `'2.0'`):
p value of the Lp norm used to pool over the input data, default is 2.0.
* **pads - INTS** :
Padding for the beginning and ending along each 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.
* **strides - INTS** :
Stride along each axis.
### 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 dimension are in the form of (N x C x D1 x D2 ... Dn), where N is the batch size.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor from Lp pooling across the input tensor. Dimensions will vary based on various kernel, stride, and pad sizes.
### Type Constraints
* **T** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)` ):
Constrain input and output types to float tensors.