1 parent
9e5be9ad24
commit
cf12f92fae
11 files changed
+387
-321
No files matched your search
+95
-83
@@ -1,12 +1,16 @@
|
||||
# Broadcast Rules For Elementwise Operations {#openvino_docs_ops_broadcast_rules}
|
||||
|
||||
@sphinxdirective
|
||||
|
||||
The purpose of this document is to provide a set of common rules which are applicable for ops using broadcasting.
|
||||
|
||||
## Description
|
||||
Description
|
||||
###########
|
||||
|
||||
Broadcast allows to perform element-wise operation for inputs of arbitrary number of dimensions. There are 2 types of broadcasts supported: Numpy and PDPD.
|
||||
|
||||
## Rules
|
||||
Rules
|
||||
#####
|
||||
|
||||
**None broadcast**:
|
||||
1. Input tensors dimensions must match.
|
||||
@@ -22,118 +26,126 @@ Broadcast allows to perform element-wise operation for inputs of arbitrary numbe
|
||||
**PDPD broadcast**:
|
||||
1. First input tensor A is of any rank, second input B has rank smaller or equal to the first input.
|
||||
2. Input tensor B is a continuous subsequence of input A.
|
||||
3. Apply broadcast B to match the shape of A, where provided *axis* is the start dimension index
|
||||
for broadcasting B onto A.
|
||||
4. If *axis* is set to default (-1) calculate new value: `axis = rank(A) - rank(B)`.
|
||||
5. The trailing dimensions of size 1 for input B will be ignored for the consideration of
|
||||
subsequence, such as `shape(B) = (3, 1) => (3)`.
|
||||
3. Apply broadcast B to match the shape of A, where provided *axis* is the start dimension index for broadcasting B onto A.
|
||||
4. If *axis* is set to default (-1) calculate new value: ``axis = rank(A) - rank(B)``.
|
||||
5. The trailing dimensions of size 1 for input B will be ignored for the consideration of subsequence, such as ``shape(B) = (3, 1) => (3)``.
|
||||
|
||||
## Numpy examples
|
||||
Numpy examples
|
||||
##############
|
||||
|
||||
* `A: Shape(,) -> scalar` <br>
|
||||
`B: Shape(,) -> scalar` <br>
|
||||
`Result: Shape(,) -> scalar`
|
||||
* ``A: Shape(,) -> scalar``
|
||||
``B: Shape(,) -> scalar``
|
||||
``Result: Shape(,) -> scalar``
|
||||
|
||||
* `A: Shape(2, 3)` <br>
|
||||
`B: Shape( 1)` <br>
|
||||
`Result: Shape(2, 3)`
|
||||
* ``A: Shape(2, 3)``
|
||||
``B: Shape( 1)``
|
||||
``Result: Shape(2, 3)``
|
||||
|
||||
* `A: Shape( 3)` <br>
|
||||
`B: Shape(2, 3)` <br>
|
||||
`Result: Shape(2, 3)`
|
||||
* ``A: Shape( 3)``
|
||||
``B: Shape(2, 3)``
|
||||
``Result: Shape(2, 3)``
|
||||
|
||||
* `A: Shape(2, 3, 5)` <br>
|
||||
`B: Shape(,) -> scalar` <br>
|
||||
`Result: Shape(2, 3, 5)`
|
||||
* ``A: Shape(2, 3, 5)``
|
||||
``B: Shape(,) -> scalar``
|
||||
``Result: Shape(2, 3, 5)``
|
||||
|
||||
* `A: Shape(2, 1, 5)` <br>
|
||||
`B: Shape(1, 4, 5)` <br>
|
||||
`Result: Shape(2, 4, 5)`
|
||||
* ``A: Shape(2, 1, 5)``
|
||||
``B: Shape(1, 4, 5)``
|
||||
``Result: Shape(2, 4, 5)``
|
||||
|
||||
* `A: Shape( 6, 5)` <br>
|
||||
`B: Shape(2, 1, 5)` <br>
|
||||
`Result: Shape(2, 6, 5)`
|
||||
* ``A: Shape( 6, 5)``
|
||||
``B: Shape(2, 1, 5)``
|
||||
``Result: Shape(2, 6, 5)``
|
||||
|
||||
* `A: Shape(2, 1, 5)` <br>
|
||||
`B: Shape( 4, 1)` <br>
|
||||
`Result: Shape(2, 4, 5)` <br>
|
||||
* ``A: Shape(2, 1, 5)``
|
||||
``B: Shape( 4, 1)``
|
||||
``Result: Shape(2, 4, 5)``
|
||||
|
||||
* `A: Shape(3, 2, 1, 4)` <br>
|
||||
`B: Shape( 5, 4)` <br>
|
||||
`Result: Shape(3, 2, 5, 4)`
|
||||
* ``A: Shape(3, 2, 1, 4)``
|
||||
``B: Shape( 5, 4)``
|
||||
``Result: Shape(3, 2, 5, 4)``
|
||||
|
||||
* `A: Shape( 1, 5, 3)` <br>
|
||||
`B: Shape(5, 2, 1, 3)` <br>
|
||||
`Result: Shape(5, 2, 5, 3)`
|
||||
* ``A: Shape( 1, 5, 3)``
|
||||
``B: Shape(5, 2, 1, 3)``
|
||||
``Result: Shape(5, 2, 5, 3)``
|
||||
|
||||
* `A: Shape(3)` <br>
|
||||
`B: Shape(2)` <br>
|
||||
`Result: broadcast won't happen due to dimensions mismatch`
|
||||
* ``A: Shape(3)``
|
||||
``B: Shape(2)``
|
||||
``Result: broadcast won't happen due to dimensions mismatch``
|
||||
|
||||
* `A: Shape(3, 1, 5)` <br>
|
||||
`B: Shape(4, 4, 5)` <br>
|
||||
`Result: broadcast won't happen due to dimensions mismatch on the leftmost axis`
|
||||
* ``A: Shape(3, 1, 5)``
|
||||
``B: Shape(4, 4, 5)``
|
||||
``Result: broadcast won't happen due to dimensions mismatch on the leftmost axis``
|
||||
|
||||
## PDPD examples
|
||||
PDPD examples
|
||||
#############
|
||||
|
||||
* `A: Shape(2, 3, 4, 5)` <br>
|
||||
`B: Shape( 3, 4 ) with axis = 1` <br>
|
||||
`Result: Shape(2, 3, 4, 5)`
|
||||
* ``A: Shape(2, 3, 4, 5)``
|
||||
``B: Shape( 3, 4 ) with axis = 1``
|
||||
``Result: Shape(2, 3, 4, 5)``
|
||||
|
||||
* `A: Shape(2, 3, 4, 5)` <br>
|
||||
`B: Shape( 3, 1 ) with axis = 1` <br>
|
||||
`Result: Shape(2, 3, 4, 5)`
|
||||
* ``A: Shape(2, 3, 4, 5)``
|
||||
``B: Shape( 3, 1 ) with axis = 1``
|
||||
``Result: Shape(2, 3, 4, 5)``
|
||||
|
||||
* `A: Shape(2, 3, 4, 5)` <br>
|
||||
`B: Shape( 4, 5) with axis=-1(default) or axis=2` <br>
|
||||
`Result: Shape(2, 3, 4, 5)`
|
||||
* ``A: Shape(2, 3, 4, 5)``
|
||||
``B: Shape( 4, 5) with axis=-1(default) or axis=2``
|
||||
``Result: Shape(2, 3, 4, 5)``
|
||||
|
||||
* `A: Shape(2, 3, 4, 5)` <br>
|
||||
`B: Shape(1, 3 ) with axis = 0` <br>
|
||||
`Result: Shape(2, 3, 4, 5)`
|
||||
* ``A: Shape(2, 3, 4, 5)``
|
||||
``B: Shape(1, 3 ) with axis = 0``
|
||||
``Result: Shape(2, 3, 4, 5)``
|
||||
|
||||
* `A: Shape(2, 3, 4, 5)` <br>
|
||||
`B: Shape(,)` <br>
|
||||
`Result: Shape(2, 3, 4, 5)` <br>
|
||||
* ``A: Shape(2, 3, 4, 5)``
|
||||
``B: Shape(,)``
|
||||
``Result: Shape(2, 3, 4, 5)``
|
||||
|
||||
* `A: Shape(2, 3, 4, 5)` <br>
|
||||
`B: Shape(5,)` <br>
|
||||
`Result: Shape(2, 3, 4, 5)`
|
||||
* ``A: Shape(2, 3, 4, 5)``
|
||||
``B: Shape(5,)``
|
||||
``Result: Shape(2, 3, 4, 5)``
|
||||
|
||||
# Bidirectional Broadcast Rules {#openvino_docs_ops_bidirectional_broadcast_rules}
|
||||
Bidirectional Broadcast Rules
|
||||
#############################
|
||||
|
||||
## Description
|
||||
Description
|
||||
+++++++++++
|
||||
|
||||
Bidirectional Broadcast is not intended for element-wise operations. Its purpose is to broadcast an array to a given shape.
|
||||
|
||||
## Rules
|
||||
Rules
|
||||
+++++
|
||||
|
||||
**Bidirectional broadcast**:
|
||||
|
||||
1. Dimensions of the input tensors are right alignment.
|
||||
2. Following broadcast rule is applied: `numpy.array(input) * numpy.ones(target_shape)`.
|
||||
2. Following broadcast rule is applied: ``numpy.array(input) * numpy.ones(target_shape)``.
|
||||
3. Two corresponding dimension must have the same value, or one of them is equal to 1.
|
||||
4. Output shape may not be equal to `target_shape` if:
|
||||
* `target_shape` contains dimensions of size 1,
|
||||
* `target_shape` rank is smaller than the rank of input tensor.
|
||||
4. Output shape may not be equal to ``target_shape`` if:
|
||||
|
||||
## Bidirectional examples
|
||||
* ``target_shape`` contains dimensions of size 1,
|
||||
* ``target_shape`` rank is smaller than the rank of input tensor.
|
||||
|
||||
* `A: Shape(5)` <br>
|
||||
`B: Shape(1)` <br>
|
||||
`Result: Shape(5)`
|
||||
Bidirectional examples
|
||||
++++++++++++++++++++++
|
||||
|
||||
* `A: Shape(2, 3)` <br>
|
||||
`B: Shape( 3)` <br>
|
||||
`Result: Shape(2, 3)`
|
||||
* ``A: Shape(5)``
|
||||
``B: Shape(1)``
|
||||
``Result: Shape(5)``
|
||||
|
||||
* `A: Shape(3, 1)` <br>
|
||||
`B: Shape(3, 4)` <br>
|
||||
`Result: Shape(3, 4)`
|
||||
* ``A: Shape(2, 3)``
|
||||
``B: Shape( 3)``
|
||||
``Result: Shape(2, 3)``
|
||||
|
||||
* `A: Shape(3, 4)` <br>
|
||||
`B: Shape(,) -> scalar` <br>
|
||||
`Result: Shape(3, 4)`
|
||||
* ``A: Shape(3, 1)``
|
||||
``B: Shape(3, 4)``
|
||||
``Result: Shape(3, 4)``
|
||||
|
||||
* `A: Shape( 3, 1)` <br>
|
||||
`B: Shape(2, 1, 6)` <br>
|
||||
`Result: Shape(2, 3, 6)`
|
||||
* ``A: Shape(3, 4)``
|
||||
``B: Shape(,) -> scalar``
|
||||
``Result: Shape(3, 4)``
|
||||
|
||||
* ``A: Shape( 3, 1)``
|
||||
``B: Shape(2, 1, 6)``
|
||||
``Result: Shape(2, 3, 6)``
|
||||
|
||||
@endsphinxdirective
|
||||
+38
-19
@@ -1,4 +1,4 @@
|
||||
# Available Operations Sets {#openvino_docs_ops_opset}
|
||||
# Available Operation Sets {#openvino_docs_ops_opset}
|
||||
|
||||
@sphinxdirective
|
||||
|
||||
@@ -18,26 +18,45 @@
|
||||
openvino_docs_ops_opset2
|
||||
openvino_docs_ops_opset1
|
||||
|
||||
@endsphinxdirective
|
||||
|
||||
According to capabilities of supported deep learning frameworks and hardware capabilities of a target inference device, all operations are combined into operations sets each fully supported in a specific version of OpenVINO™ toolkit.
|
||||
According to capabilities of supported deep learning frameworks and hardware capabilities of a target inference device, all operations are combined into operation sets each fully supported in a specific version of OpenVINO™ toolkit.
|
||||
|
||||
This topic provides a complete list of available sets of operations supported in different versions of OpenVINO™ toolkit. Use the relevant version of the operations set for a particular release. For a list of operations included into an operations set, click a link in the table.
|
||||
|
||||
| OpenVINO™ Version | Actual Operations Set |
|
||||
| :---------------- | :------------------------------- |
|
||||
| 2023.0 | [opset11](opset11.md) |
|
||||
| 2022.3 | [opset10](opset10.md) |
|
||||
| 2022.2 | [opset9](opset9.md) |
|
||||
| 2022.1 | [opset8](opset8.md) |
|
||||
| 2021.4 | [opset7](opset7.md) |
|
||||
| 2021.3 | [opset6](opset6.md) |
|
||||
| 2021.2 | [opset5](opset5.md) |
|
||||
| 2021.1 | [opset4](opset4.md) |
|
||||
| 2020.4 | [opset3](opset3.md) |
|
||||
| 2020.3 | [opset2](opset2.md) |
|
||||
| 2020.2 | [opset2](opset2.md) |
|
||||
| 2020.1 | [opset1](opset1.md) |
|
||||
.. list-table::
|
||||
:header-rows: 1
|
||||
|
||||
## See Also
|
||||
[Deep Learning Network Intermediate Representation and Operations Sets in OpenVINO™](../MO_DG/IR_and_opsets.md)
|
||||
* - OpenVINO™ Version
|
||||
- Actual Operations Set
|
||||
* - 2023.0
|
||||
- :doc:`opset11 <openvino_docs_ops_opset11>`
|
||||
* - 2022.3
|
||||
- :doc:`opset10 <openvino_docs_ops_opset10>`
|
||||
* - 2022.2
|
||||
- :doc:`opset9 <openvino_docs_ops_opset9>`
|
||||
* - 2022.1
|
||||
- :doc:`opset8 <openvino_docs_ops_opset8>`
|
||||
* - 2021.4
|
||||
- :doc:`opset7 <openvino_docs_ops_opset7>`
|
||||
* - 2021.3
|
||||
- :doc:`opset6 <openvino_docs_ops_opset6>`
|
||||
* - 2021.2
|
||||
- :doc:`opset5 <openvino_docs_ops_opset5>`
|
||||
* - 2021.1
|
||||
- :doc:`opset4 <openvino_docs_ops_opset4>`
|
||||
* - 2020.4
|
||||
- :doc:`opset3 <openvino_docs_ops_opset3>`
|
||||
* - 2020.3
|
||||
- :doc:`opset2 <openvino_docs_ops_opset2>`
|
||||
* - 2020.2
|
||||
- :doc:`opset2 <openvino_docs_ops_opset2>`
|
||||
* - 2020.1
|
||||
- :doc:`opset1 <openvino_docs_ops_opset1>`
|
||||
|
||||
See Also
|
||||
########
|
||||
|
||||
:doc:`Operation Sets in OpenVINO <openvino_docs_MO_DG_IR_and_opsets>`
|
||||
:doc:`OpenVINO IR format <openvino_ir>`
|
||||
|
||||
@endsphinxdirective
|
||||
Reference in new issue
Block a user