Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[SPEC][Op] BitwiseLeftShift & BitwiseRightShift specification (#25960)

Katarzyna Mitrus547c21574edb
diff --git a/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/bitwise/bitwise-left-shift-15.rst b/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/bitwise/bitwise-left-shift-15.rst
new file mode 100644
index 00000000000..e7116188685
--- /dev/null
+++ b/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/bitwise/bitwise-left-shift-15.rst
@@ -0,0 +1,112 @@
+.. {#openvino_docs_ops_bitwise_BitwiseLeftShift_15}
+
+BitwiseLeftShift
+================
+
+
+.. meta::
+ :description: Learn about BitwiseLeftShift-15 - an element-wise, bitwise left shift operation.
+
+**Versioned name**: *BitwiseLeftShift-15*
+
+**Category**: *Bitwise binary*
+
+**Short description**: *BitwiseLeftShift* performs a bitwise left shift operation operation, applying multi-directional broadcast rules.
+
+**Detailed description**: Before performing the operation, input tensors *a* and *b* are broadcasted if their shapes are different and the ``auto_broadcast`` attribute is not ``none``. Broadcasting is performed according to the ``auto_broadcast`` value.
+
+After broadcasting input tensors *a* and *b*, *BitwiseLeftShift* performs a bitwise left shift operation for each corresponding element in the given tensors, based on the following equation:
+
+.. math::
+
+ o_{i} = a_{i} \ll b_{i}
+
+
+.. note::
+
+ If the number of shifts is negative, or if it equals or exceeds the total number of bits in the type **T**, the behavior can be undefined or implementation-defined (depends on the hardware).
+
+
+**Attributes**:
+
+* *auto_broadcast*
+
+ * **Description**: specifies the rules used for auto-broadcasting of input tensors.
+ * **Range of values**:
+
+ * *none* - no auto-broadcasting is allowed, all input shapes must match,
+ * *numpy* - numpy broadcasting rules, description is available in :doc:`Broadcast Rules For Elementwise Operations <../../broadcast-rules>`,
+ * *pdpd* - PaddlePaddle-style implicit broadcasting, description is available in :doc:`Broadcast Rules For Elementwise Operations <../../broadcast-rules>`.
+
+ * **Type**: string
+ * **Default value**: "numpy"
+ * **Required**: *no*
+
+**Inputs**
+
+* **1**: A tensor of type *T* and arbitrary shape, containing data to be shifted. **Required.**
+* **2**: A tensor of type *T* and arbitrary shape, with the number of shifts. **Required.**
+
+**Outputs**
+
+* **1**: The result of element-wise *BitwiseLeftShift* operation. A tensor of type *T* and the shape equal to the broadcasted shape of two inputs.
+
+**Types**
+
+* *T*: ``any supported integer type``.
+
+**Examples**
+
+*Example 1: no broadcast*
+
+.. code-block:: xml
+ :force:
+
+ <layer ... type="BitwiseLeftShift">
+ <input>
+ <port id="0">
+ <dim>256</dim>
+ <dim>56</dim>
+ </port>
+ <port id="1">
+ <dim>256</dim>
+ <dim>56</dim>
+ </port>
+ </input>
+ <output>
+ <port id="2">
+ <dim>256</dim>
+ <dim>56</dim>
+ </port>
+ </output>
+ </layer>
+
+
+*Example 2: numpy broadcast*
+
+.. code-block:: xml
+ :force:
+
+ <layer ... type="BitwiseLeftShift">
+ <input>
+ <port id="0">
+ <dim>8</dim>
+ <dim>1</dim>
+ <dim>6</dim>
+ <dim>1</dim>
+ </port>
+ <port id="1">
+ <dim>7</dim>
+ <dim>1</dim>
+ <dim>5</dim>
+ </port>
+ </input>
+ <output>
+ <port id="2">
+ <dim>8</dim>
+ <dim>7</dim>
+ <dim>6</dim>
+ <dim>5</dim>
+ </port>
+ </output>
+ </layer>
diff --git a/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/bitwise/bitwise-right-shift-15.rst b/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/bitwise/bitwise-right-shift-15.rst
new file mode 100644
index 00000000000..5ec3b3768fc
--- /dev/null
+++ b/docs/articles_en/documentation/openvino-ir-format/operation-sets/operation-specs/bitwise/bitwise-right-shift-15.rst
@@ -0,0 +1,112 @@
+.. {#openvino_docs_ops_bitwise_BitwiseRightShift_15}
+
+BitwiseRightShift
+=================
+
+
+.. meta::
+ :description: Learn about BitwiseRightShift-15 - an element-wise, bitwise right shift operation.
+
+**Versioned name**: *BitwiseRightShift-15*
+
+**Category**: *Bitwise binary*
+
+**Short description**: *BitwiseRightShift* performs a bitwise right shift operation operation, applying multi-directional broadcast rules.
+
+**Detailed description**: Before performing the operation, input tensors *a* and *b* are broadcasted if their shapes are different and the ``auto_broadcast`` attribute is not ``none``. Broadcasting is performed according to the ``auto_broadcast`` value.
+
+After broadcasting input tensors *a* and *b*, *BitwiseRightShift* performs a bitwise right shift operation for each corresponding element in the given tensors, based on the following equation:
+
+.. math::
+
+ o_{i} = a_{i} \gg b_{i}
+
+
+.. note::
+
+ If the number of shifts is negative, or if it equals or exceeds the total number of bits in the type **T**, the behavior can be undefined or implementation-defined (depends on the hardware).
+
+
+**Attributes**:
+
+* *auto_broadcast*
+
+ * **Description**: specifies the rules used for auto-broadcasting of input tensors.
+ * **Range of values**:
+
+ * *none* - no auto-broadcasting is allowed, all input shapes must match,
+ * *numpy* - numpy broadcasting rules, description is available in :doc:`Broadcast Rules For Elementwise Operations <../../broadcast-rules>`,
+ * *pdpd* - PaddlePaddle-style implicit broadcasting, description is available in :doc:`Broadcast Rules For Elementwise Operations <../../broadcast-rules>`.
+
+ * **Type**: string
+ * **Default value**: "numpy"
+ * **Required**: *no*
+
+**Inputs**
+
+* **1**: A tensor of type *T* and arbitrary shape, containing data to be shifted. **Required.**
+* **2**: A tensor of type *T* and arbitrary shape, with the number of shifts. **Required.**
+
+**Outputs**
+
+* **1**: The result of element-wise *BitwiseRightShift* operation. A tensor of type *T* and the shape equal to the broadcasted shape of two inputs.
+
+**Types**
+
+* *T*: ``any supported integer type``.
+
+**Examples**
+
+*Example 1: no broadcast*
+
+.. code-block:: xml
+ :force:
+
+ <layer ... type="BitwiseRightShift">
+ <input>
+ <port id="0">
+ <dim>256</dim>
+ <dim>56</dim>
+ </port>
+ <port id="1">
+ <dim>256</dim>
+ <dim>56</dim>
+ </port>
+ </input>
+ <output>
+ <port id="2">
+ <dim>256</dim>
+ <dim>56</dim>
+ </port>
+ </output>
+ </layer>
+
+
+*Example 2: numpy broadcast*
+
+.. code-block:: xml
+ :force:
+
+ <layer ... type="BitwiseRightShift">
+ <input>
+ <port id="0">
+ <dim>8</dim>
+ <dim>1</dim>
+ <dim>6</dim>
+ <dim>1</dim>
+ </port>
+ <port id="1">
+ <dim>7</dim>
+ <dim>1</dim>
+ <dim>5</dim>
+ </port>
+ </input>
+ <output>
+ <port id="2">
+ <dim>8</dim>
+ <dim>7</dim>
+ <dim>6</dim>
+ <dim>5</dim>
+ </port>
+ </output>
+ </layer>