Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Opset15][Spec] Col2Im-15 specification #23947

Merged
merged 21 commits into from
May 16, 2024
Merged
Changes from 13 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d0ee316
initial commit
p-wysocki Apr 9, 2024
d06bed4
Update docs/articles_en/documentation/openvino-ir-format/operation-se…
p-wysocki Apr 11, 2024
0e541b0
Merge remote-tracking branch 'upstream/master' into col2im_spec
p-wysocki Apr 18, 2024
39ee005
Apply CR
p-wysocki Apr 18, 2024
d64563d
Merge branch 'col2im_spec' of https://github.com/p-wysocki/openvino i…
p-wysocki Apr 18, 2024
d7eff8e
Minor update
p-wysocki Apr 18, 2024
68782db
Update docs/articles_en/documentation/openvino-ir-format/operation-se…
p-wysocki Apr 18, 2024
9f95220
minor update
p-wysocki Apr 18, 2024
c31c5f3
Update
p-wysocki Apr 19, 2024
af36fc1
Update docs/articles_en/documentation/openvino-ir-format/operation-se…
p-wysocki Apr 23, 2024
fd4865d
Update latex equation
p-wysocki Apr 23, 2024
dbb09d0
Merge branch 'master' of https://github.com/openvinotoolkit/openvino …
p-wysocki Apr 23, 2024
86a35fa
Merge branch 'col2im_spec' of https://github.com/p-wysocki/openvino i…
p-wysocki Apr 23, 2024
67db605
Merge branch 'master' of https://github.com/openvinotoolkit/openvino …
p-wysocki May 7, 2024
81a9459
Apply CR
p-wysocki May 7, 2024
769428f
Apply CR
p-wysocki May 7, 2024
708252d
Minor change
p-wysocki May 9, 2024
d13b3b4
Apply CR
p-wysocki May 9, 2024
f7c4ad9
Merge branch 'master' of https://github.com/openvinotoolkit/openvino …
p-wysocki May 9, 2024
c5f0c96
Turn equation into text
p-wysocki May 14, 2024
3b48cbc
Merge branch 'master' of https://github.com/openvinotoolkit/openvino …
p-wysocki May 14, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
.. {#openvino_docs_ops_type_Col2Im_15}

Col2Im
===================


.. meta::
:description: Learn about Col2Im-15 - data movement operation which combines sliding blocks into an image tensor.

**Versioned name**: *Col2Im-15*

**Category**: *Data movement*

**Short description**: *Col2Im* operation constructs an image based on ``input`` tensor containing sliding data blocks (blocks of the image) and desired ``output_size``.

**Detailed description**

Consider an ``input`` tensor containing batches of image blocks of shape ``(N, C * Product(kernel_size), L)``, where:

* ``N`` is the batch dimension,
* ``C * Product(kernel_size)`` is the number of elements within a block (each block contains ``Product(kernel_size)`` vectors containing values from each channel ``C``),
* ``L`` is the total number of blocks calculated as follows:

.. math::

L = \prod_{d=1}^{2} \lfloor \frac{({\text{{output\_size}}[d] + \text{{pads\_begin}}[d] + \text{{pads\_end}}[d] - \text{{dilation}}[d] \times (\text{{kernel\_size}}[d] - 1) - 1}}{{\text{{stride}}[d]}}) + 1\rfloor
p-wysocki marked this conversation as resolved.
Show resolved Hide resolved


where ``d`` is over all spatial dimensions.

The ``input`` blocks are being moved into the ``output`` tensor of shape ``(N, C, output_size[0], output_size[1])`` by combining the values contained in blocks.

Non-batched inputs are also supported, in which case the ``input`` has shape ``(C * Product(kernel_size), L)`` and the output has shape ``(C, output_size[0], output_size[1])``.
p-wysocki marked this conversation as resolved.
Show resolved Hide resolved

**Attributes**:

* *strides*

* **Description**: stride in the sliding blocks in the input spatial dimensions.
* **Range of values**: 1D tensor of non-negative integer numbers
p-wysocki marked this conversation as resolved.
Show resolved Hide resolved
* **Type**: *T_IND*
* **Default value**: [1, 1]
* **Required**: *no*

* *dilations*

* **Description**: controls local stride of the elements.
* **Range of values**: 1D tensor of non-negative integer numbers
* **Type**: *T_IND*
* **Default value**: [1, 1]
* **Required**: *no*

* *pads_begin*

* **Description**: *pads_begin* is a number of zero-value pixels to add to the beginning along each axis. For example, *pads_begin* equal "1,2" means adding 1 pixel to the top of the input and 2 to the left of the input.
* **Range of values**: 1D tensor of non-negative integer numbers
* **Type**: *T_IND*
* **Default value**: [0, 0]
* **Required**: *no*

* *pads_end*

* **Description**: *pads_end* is a number of zero-value pixels to add to the ending along each axis. For example, *pads_end* equal "1,2" means adding 1 pixel to the bottom of the input and 2 to the right of the input.
* **Range of values**: 1D tensor of non-negative integer numbers
* **Type**: *T_IND*
* **Default value**: [0, 0]
* **Required**: *no*

**Inputs**

* **1**: *data*

* **Description**: A batched 3D tensor of type *T* and shape ``(N, C * Product(kernel_size), L)`` or an unbatched 2D tensor of type *T* and shape ``(C * Product(kernel_size), L)``. **Required.**
* **Range of values**: 1D tensor of non-negative integer numbers
* **Type**: *T*

* **2**: *output_size*

* **Description**: controls the shape of the spatial dimensions of the output image. **Required.**
* **Range of values**: batched 3D or unbatched 2D tensor of non-negative integer numbers
p-wysocki marked this conversation as resolved.
Show resolved Hide resolved
* **Type**: *T_IND*

* **3**: *kernel_size*

* **Description**: size of the sliding blocks. **Required.**
* **Range of values**: 1D tensor of non-negative integer numbers
* **Type**: *T_IND*

**Outputs**

* **1**: The output tensor the output image of type *T* and shape:

* ``(N, C, output_size[0], output_size[1])`` in case of batched input,
* ``(C, output_size[0], output_size[1])`` in case of non-batched input.

**Types**

* *T*: any supported data type.
* *T_IND*: ``int64`` or ``int32``.
p-wysocki marked this conversation as resolved.
Show resolved Hide resolved

**Examples**

All examples assume ``C = 3``.

*Example 1: default optional Parameters*

.. code-block:: xml
:force:

<layer ... type="Col2Im" ... >
<data output_size="16,16" kernel_size="2,2"/>
p-wysocki marked this conversation as resolved.
Show resolved Hide resolved
<input>
<port id="0" precision="I32">
<dim>3</dim> <!-- batch_axis -->
<dim>12</dim> <!-- C * Product(kernel_size) -->
<dim>225</dim> <!-- L -->
</port>
</input>
<output>
<port id="1" precision="I32">
<dim>3</dim> <!-- batch_axis -->
<dim>3</dim> <!-- C -->
<dim>16</dim> <!-- output_size[0] -->
<dim>16</dim> <!-- output_size[1] -->
</port>
</output>
</layer>


*Example 2: non-default dilations, padding and strides*

.. code-block:: xml
:force:

<layer ... type="Col2Im" ... >
<data output_size="16,16" kernel_size="3,3" dilations="2,2" pads_begin="1,1" pads_end="1,1" strides="2,2"/>
<input>
<port id="0" precision="I32">
<dim>1</dim> <!-- batch_axis -->
<dim>27/dim> <!-- C * Product(kernel_size) -->
<dim>25</dim> <!-- L -->
</port>
</input>
<output>
<port id="1" precision="I32">
<dim>1</dim> <!-- batch_axis -->
<dim>3</dim> <!-- C -->
<dim>16</dim> <!-- output_size[0] -->
<dim>16</dim> <!-- output_size[1] -->
</port>
</output>
</layer>

*Example 3: non-default dilations and padding*

.. code-block:: xml
:force:

<layer ... type="Col2Im" ... >
<data output_size="32,32" kernel_size="2,2" dilations="2,2" pads_begin="3,3" pads_end="3,3"/>
<input>
<port id="0" precision="I32">
<dim>12</dim> <!-- batch_axis -->
<dim>12/dim> <!-- C * Product(kernel_size) -->
<dim>324</dim> <!-- L -->
</port>
</input>
<output>
<port id="1" precision="I32">
<dim>12</dim> <!-- batch_axis -->
<dim>3</dim> <!-- C -->
<dim>32</dim> <!-- output_size[0] -->
<dim>32</dim> <!-- output_size[1] -->
</port>
</output>
</layer>

*Example 4: default optional Parameters, unbatched*

.. code-block:: xml
:force:

<layer ... type="Col2Im" ... >
<data output_size="16,16" kernel_size="2,2"/>
<input>
<port id="0" precision="I32">
<dim>12</dim> <!-- C * Product(kernel_size) -->
<dim>225</dim> <!-- L -->
</port>
</input>
<output>
<port id="1" precision="I32">
<dim>3</dim> <!-- C -->
<dim>16</dim> <!-- output_size[0] -->
<dim>16</dim> <!-- output_size[1] -->
</port>
</output>
</layer>
Loading