(l-onnx-doc-Conv)=
# Conv
(l-onnx-op-conv-22)=
## Conv - 22
### Version
- **name**: [Conv (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#Conv)
- **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
The convolution operator consumes an input tensor and a filter, and
computes the output.
### 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.
* **dilations - INTS** :
dilation value along each spatial axis of the filter. If not present, the dilation defaults is 1 along each spatial axis.
* **group - INT** (default is `'1'`):
number of groups input channels and output channels are divided into.
* **kernel_shape - INTS** :
The shape of the convolution kernel. If not present, should be inferred from input W.
* **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 is 1 along each spatial axis.
### Inputs
Between 2 and 3 inputs.
- **X** (heterogeneous) - **T**:
Input data tensor from previous layer; has size (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 width. Note that this is for the 2D image. Otherwise the size is (N x C x D1 x D2 ... x Dn). Optionally, if dimension denotation is in effect, the operation expects input data tensor to arrive with the dimension denotation of [DATA_BATCH, DATA_CHANNEL, DATA_FEATURE, DATA_FEATURE ...].
- **W** (heterogeneous) - **T**:
The weight tensor that will be used in the convolutions; has size (M x C/group x kH x kW), where C is the number of channels, and kH and kW are the height and width of the kernel, and M is the number of feature maps. For more than 2 dimensions, the kernel shape will be (M x C/group x k1 x k2 x ... x kn), where (k1 x k2 x ... kn) is the dimension of the kernel. Optionally, if dimension denotation is in effect, the operation expects the weight tensor to arrive with the dimension denotation of [FILTER_OUT_CHANNEL, FILTER_IN_CHANNEL, FILTER_SPATIAL, FILTER_SPATIAL ...]. Assuming zero based indices for the shape array, X.shape[1] == (W.shape[1] * group) == C and W.shape[0] mod G == 0. Or in other words FILTER_IN_CHANNEL multiplied by the number of groups should be equal to DATA_CHANNEL and the number of feature maps M should be a multiple of the number of groups G.
- **B** (optional, heterogeneous) - **T**:
Optional 1D bias to be added to the convolution, has size of M.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor that contains the result of the convolution. The output dimensions are functions of the kernel size, stride size, and pad lengths.
### Type Constraints
* **T** in ( `tensor(bfloat16)`, `tensor(double)`, `tensor(float)`, `tensor(float16)` ):
Constrain input and output types to float tensors.
```{toctree}
text_diff_Conv_11_22
```
(l-onnx-op-conv-11)=
## Conv - 11
### Version
- **name**: [Conv (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#Conv)
- **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
The convolution operator consumes an input tensor and a filter, and
computes the output.
### 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.
* **dilations - INTS** :
dilation value along each spatial axis of the filter. If not present, the dilation defaults is 1 along each spatial axis.
* **group - INT** (default is `'1'`):
number of groups input channels and output channels are divided into.
* **kernel_shape - INTS** :
The shape of the convolution kernel. If not present, should be inferred from input W.
* **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 is 1 along each spatial axis.
### Inputs
Between 2 and 3 inputs.
- **X** (heterogeneous) - **T**:
Input data tensor from previous layer; has size (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 width. Note that this is for the 2D image. Otherwise the size is (N x C x D1 x D2 ... x Dn). Optionally, if dimension denotation is in effect, the operation expects input data tensor to arrive with the dimension denotation of [DATA_BATCH, DATA_CHANNEL, DATA_FEATURE, DATA_FEATURE ...].
- **W** (heterogeneous) - **T**:
The weight tensor that will be used in the convolutions; has size (M x C/group x kH x kW), where C is the number of channels, and kH and kW are the height and width of the kernel, and M is the number of feature maps. For more than 2 dimensions, the kernel shape will be (M x C/group x k1 x k2 x ... x kn), where (k1 x k2 x ... kn) is the dimension of the kernel. Optionally, if dimension denotation is in effect, the operation expects the weight tensor to arrive with the dimension denotation of [FILTER_OUT_CHANNEL, FILTER_IN_CHANNEL, FILTER_SPATIAL, FILTER_SPATIAL ...]. Assuming zero based indices for the shape array, X.shape[1] == (W.shape[1] * group) == C and W.shape[0] mod G == 0. Or in other words FILTER_IN_CHANNEL multiplied by the number of groups should be equal to DATA_CHANNEL and the number of feature maps M should be a multiple of the number of groups G.
- **B** (optional, heterogeneous) - **T**:
Optional 1D bias to be added to the convolution, has size of M.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor that contains the result of the convolution. The output dimensions are functions of the kernel size, stride size, and pad lengths.
### Type Constraints
* **T** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)`, `tensor(float16)` ):
Constrain input and output types to float tensors.
```{toctree}
text_diff_Conv_1_22
text_diff_Conv_1_11
```
(l-onnx-op-conv-1)=
## Conv - 1
### Version
- **name**: [Conv (GitHub)](https://github.com/onnx/onnx/blob/main/docs/Operators.md#Conv)
- **domain**: `main`
- **since_version**: `1`
- **function**: `False`
- **support_level**: `SupportType.COMMON`
- **shape inference**: `True`
This version of the operator has been available
**since version 1**.
### Summary
The convolution operator consumes an input tensor and a filter, and
computes the output.
### 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.
* **dilations - INTS** :
dilation value along each spatial axis of the filter.
* **group - INT** (default is `'1'`):
number of groups input channels and output channels are divided into.
* **kernel_shape - INTS** :
The shape of the convolution kernel. If not present, should be inferred from input W.
* **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
Between 2 and 3 inputs.
- **X** (heterogeneous) - **T**:
Input data tensor from previous layer; has size (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 width. Note that this is for the 2D image. Otherwise the size is (N x C x D1 x D2 ... x Dn). Optionally, if dimension denotation is in effect, the operation expects input data tensor to arrive with the dimension denotation of [DATA_BATCH, DATA_CHANNEL, DATA_FEATURE, DATA_FEATURE ...].
- **W** (heterogeneous) - **T**:
The weight tensor that will be used in the convolutions; has size (M x C/group x kH x kW), where C is the number of channels, and kH and kW are the height and width of the kernel, and M is the number of feature maps. For more than 2 dimensions, the kernel shape will be (M x C/group x k1 x k2 x ... x kn), where (k1 x k2 x ... kn) is the dimension of the kernel. Optionally, if dimension denotation is in effect, the operation expects the weight tensor to arrive with the dimension denotation of [FILTER_OUT_CHANNEL, FILTER_IN_CHANNEL, FILTER_SPATIAL, FILTER_SPATIAL ...]. X.shape[1] == (W.shape[1] * group) == C (assuming zero based indices for the shape array). Or in other words FILTER_IN_CHANNEL should be equal to DATA_CHANNEL.
- **B** (optional, heterogeneous) - **T**:
Optional 1D bias to be added to the convolution, has size of M.
### Outputs
- **Y** (heterogeneous) - **T**:
Output data tensor that contains the result of the convolution. The output dimensions are functions of the kernel size, stride size, and pad lengths.
### Type Constraints
* **T** in ( `tensor(double)`, `tensor(float)`, `tensor(float16)` ):
Constrain input and output types to float tensors.