diff --git a/docs/ops/activation/Elu_1.md b/docs/ops/activation/Elu_1.md index cffa21150ac248..df95b8ddf046ee 100644 --- a/docs/ops/activation/Elu_1.md +++ b/docs/ops/activation/Elu_1.md @@ -1,5 +1,7 @@ # Elu {#openvino_docs_ops_activation_Elu_1} +@sphinxdirective + **Versioned name**: *Elu-1* **Category**: *Activation function* @@ -8,15 +10,16 @@ **Detailed Description** -*Elu* operation is introduced in this [article](https://arxiv.org/abs/1511.07289v3). +*Elu* operation is introduced in this `article `__. It performs element-wise activation function on a given input tensor, based on the following mathematical formula: -\f[ -Elu(x) = \left\{\begin{array}{r} - x \qquad \mbox{if } x > 0 \\ - \alpha(e^{x} - 1) \quad \mbox{if } x \leq 0 -\end{array}\right. -\f] +.. math:: + + Elu(x) = \left\begin{array}{r} + x \qquad \mbox{if } x > 0 \\ + \alpha(e^{x} - 1) \quad \mbox{if } x \leq 0 + \end{array}\right. + where α corresponds to *alpha* attribute. @@ -28,16 +31,16 @@ where α corresponds to *alpha* attribute. * **Description**: scale for the negative factor * **Range of values**: non-negative arbitrary floating-point number - * **Type**: `float` + * **Type**: ``float`` * **Required**: *yes* **Inputs**: -* **1**: A tensor of type *T* and arbitrary shape. **Required.** +* **1**: A tensor of type *T* and arbitrary shape. **Required.** **Outputs**: -* **1**: The result of element-wise *Elu* function applied to the input tensor. A tensor of type *T* and the same shape as input tensor. +* **1**: The result of element-wise *Elu* function applied to the input tensor. A tensor of type *T* and the same shape as input tensor. **Types** @@ -45,20 +48,22 @@ where α corresponds to *alpha* attribute. **Example** -```xml - - - - - 1 - 128 - - - - - 1 - 128 - - - -``` +.. code-block:: cpp + + + + + + 1 + 128 + + + + + 1 + 128 + + + + +@endsphinxdirective diff --git a/docs/ops/activation/Exp_1.md b/docs/ops/activation/Exp_1.md index 6b91ec371d42f5..0576de59e5d49b 100644 --- a/docs/ops/activation/Exp_1.md +++ b/docs/ops/activation/Exp_1.md @@ -1,5 +1,7 @@ # Exp {#openvino_docs_ops_activation_Exp_1} +@sphinxdirective + **Versioned name**: *Exp-1* **Category**: *Activation function* @@ -10,19 +12,19 @@ *Exp* performs element-wise exponential activation function on a given input tensor. The mathematical formula is as follows: -\f[ -exp(x) = e^{x} -\f] +.. math:: + + exp(x) = e^{x} **Attributes**: *Exp* operation has no attributes. **Inputs** -* **1**: A tensor of type *T* and arbitrary shape. **Required.** +* **1**: A tensor of type *T* and arbitrary shape. **Required.** **Outputs** -* **1**: The result of element-wise *Exp* function applied to the input tensor. A tensor of type *T* and the same shape as input tensor. +* **1**: The result of element-wise *Exp* function applied to the input tensor. A tensor of type *T* and the same shape as input tensor. **Types** @@ -30,19 +32,22 @@ exp(x) = e^{x} **Example** -```xml - - - - 1 - 256 - - - - - 1 - 256 - - - -``` +.. code-block:: cpp + + + + + 1 + 256 + + + + + 1 + 256 + + + + +@endsphinxdirective + diff --git a/docs/ops/arithmetic/Abs_1.md b/docs/ops/arithmetic/Abs_1.md index ec5ce9125d1e50..b727a635bce098 100644 --- a/docs/ops/arithmetic/Abs_1.md +++ b/docs/ops/arithmetic/Abs_1.md @@ -35,7 +35,7 @@ No attributes available. *Example 1* -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Acos_1.md b/docs/ops/arithmetic/Acos_1.md index e71c62a34d6655..6018bacb1633bb 100644 --- a/docs/ops/arithmetic/Acos_1.md +++ b/docs/ops/arithmetic/Acos_1.md @@ -34,7 +34,7 @@ No attributes available. *Example 1* -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Acosh_3.md b/docs/ops/arithmetic/Acosh_3.md index 5b4304519f1f76..f0dfc62179b083 100644 --- a/docs/ops/arithmetic/Acosh_3.md +++ b/docs/ops/arithmetic/Acosh_3.md @@ -30,7 +30,7 @@ **Examples** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Add_1.md b/docs/ops/arithmetic/Add_1.md index ad24ac6e9b0cef..d773d21c386ca5 100644 --- a/docs/ops/arithmetic/Add_1.md +++ b/docs/ops/arithmetic/Add_1.md @@ -49,7 +49,7 @@ After broadcasting *Add* performs addition operation for the input tensors *a* a *Example 1* -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Asin_1.md b/docs/ops/arithmetic/Asin_1.md index fdb83abde51793..becea7827dd81f 100644 --- a/docs/ops/arithmetic/Asin_1.md +++ b/docs/ops/arithmetic/Asin_1.md @@ -34,7 +34,7 @@ No attributes available. *Example 1* -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Asinh_3.md b/docs/ops/arithmetic/Asinh_3.md index 5a027b23054794..4ff0f72b6352cf 100644 --- a/docs/ops/arithmetic/Asinh_3.md +++ b/docs/ops/arithmetic/Asinh_3.md @@ -30,7 +30,7 @@ **Example** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Atan_1.md b/docs/ops/arithmetic/Atan_1.md index 36d908fe4df077..e9fa48afb47c28 100644 --- a/docs/ops/arithmetic/Atan_1.md +++ b/docs/ops/arithmetic/Atan_1.md @@ -30,7 +30,7 @@ **Examples** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Atanh_3.md b/docs/ops/arithmetic/Atanh_3.md index b466587e6e76b4..056c6719c0859f 100644 --- a/docs/ops/arithmetic/Atanh_3.md +++ b/docs/ops/arithmetic/Atanh_3.md @@ -45,7 +45,7 @@ Unsigned Intragral type put: **Examples** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/arithmetic/Erf_1.md b/docs/ops/arithmetic/Erf_1.md index 7b13f4e9eedf65..9f4911c0afc127 100644 --- a/docs/ops/arithmetic/Erf_1.md +++ b/docs/ops/arithmetic/Erf_1.md @@ -1,5 +1,7 @@ # Erf {#openvino_docs_ops_arithmetic_Erf_1} +@sphinxdirective + **Versioned name**: *Erf-1* **Category**: *Arithmetic unary* @@ -10,9 +12,9 @@ *Erf* performs element-wise erf operation on a given input tensor, based on the following mathematical formula: -\f[ -erf(x) = \pi^{-1} \int_{-x}^{x} e^{-t^2} dt -\f] +.. math:: + + erf(x) = \pi^{-1} \int_{-x}^{x} e^{-t^2} dt **Attributes**: *Erf* operation has no attributes. @@ -28,22 +30,24 @@ erf(x) = \pi^{-1} \int_{-x}^{x} e^{-t^2} dt * *T*: any supported numeric type. - **Example** -```xml - - - - 256 - 56 - - - - - 256 - 56 - - - -``` +.. code-block:: cpp + + + + + 256 + 56 + + + + + 256 + 56 + + + + +@endsphinxdirective + diff --git a/docs/ops/comparison/Equal_1.md b/docs/ops/comparison/Equal_1.md index 980ed5d533defc..fdbee520c5c6ba 100644 --- a/docs/ops/comparison/Equal_1.md +++ b/docs/ops/comparison/Equal_1.md @@ -1,4 +1,6 @@ -# Equal {#openvino_docs_ops_comparison_Equal_1} +# Equal {#openvino_docs_ops_comparison_Equal_1} + +@sphinxdirective **Versioned name**: *Equal-1* @@ -11,9 +13,9 @@ Before performing arithmetic operation, input tensors *a* and *b* are broadcaste After broadcasting *Equal* does the following with the input tensors *a* and *b*: -\f[ -o_{i} = a_{i} == b_{i} -\f] +.. math:: + + o_{i} = a_{i} == b_{i} **Attributes**: @@ -21,10 +23,11 @@ o_{i} = a_{i} == b_{i} * **Description**: specifies rules used for auto-broadcasting of input tensors. * **Range of values**: + * *none* - no auto-broadcasting is allowed, all input shapes should match, - * *numpy* - numpy broadcasting rules, description is available in [Broadcast Rules For Elementwise Operations](../broadcast_rules.md), - * *pdpd* - PaddlePaddle-style implicit broadcasting, description is available in [Broadcast Rules For Elementwise Operations](../broadcast_rules.md). - * **Type**: string + * *numpy* - numpy broadcasting rules, description is available in :doc:`Broadcast Rules For Elementwise Operations `, + * *pdpd* - PaddlePaddle-style implicit broadcasting, description is available in :doc:`Broadcast Rules For Elementwise Operations `. + * **Type**: ``string`` * **Default value**: "numpy" * **Required**: *no* @@ -40,58 +43,62 @@ o_{i} = a_{i} == b_{i} **Types** * *T*: arbitrary supported type. -* *T_BOOL*: `boolean`. +* *T_BOOL*: ``boolean``. **Examples** *Example 1: no broadcast* -```xml - - - - - 256 - 56 - - - 256 - 56 - - - - - 256 - 56 - - - -``` +.. code-block:: cpp + + + + + + 256 + 56 + + + 256 + 56 + + + + + 256 + 56 + + + *Example 2: numpy broadcast* -```xml - - - - - 8 - 1 - 6 - 1 - - - 7 - 1 - 5 - - - - - 8 - 7 - 6 - 5 - - - -``` + +.. code-block:: cpp + + + + + + 8 + 1 + 6 + 1 + + + 7 + 1 + 5 + + + + + 8 + 7 + 6 + 5 + + + + +@endsphinxdirective + diff --git a/docs/ops/detection/ExperimentalDetectronDetectionOutput_6.md b/docs/ops/detection/ExperimentalDetectronDetectionOutput_6.md index 7bbe7bf7ab6512..cebc9594d61280 100644 --- a/docs/ops/detection/ExperimentalDetectronDetectionOutput_6.md +++ b/docs/ops/detection/ExperimentalDetectronDetectionOutput_6.md @@ -1,5 +1,7 @@ # ExperimentalDetectronDetectionOutput {#openvino_docs_ops_detection_ExperimentalDetectronDetectionOutput_6} +@sphinxdirective + **Versioned name**: *ExperimentalDetectronDetectionOutput-6* **Category**: *Object detection* @@ -9,48 +11,45 @@ the detection output using information on location and score predictions. **Detailed description**: The operation performs the following steps: -1. Applies deltas to boxes sizes [x1, y1, x2, y2] and takes coordinates of +1. Applies deltas to boxes sizes [x 1, y 1, x 2, y 2] and takes coordinates of refined boxes according to the formulas: -`x1_new = ctr_x + (dx - 0.5 * exp(min(d_log_w, max_delta_log_wh))) * box_w` +``x1_new = ctr_x + (dx - 0.5 * exp(min(d_log_w, max_delta_log_wh))) * box_w`` -`y0_new = ctr_y + (dy - 0.5 * exp(min(d_log_h, max_delta_log_wh))) * box_h` +``y0_new = ctr_y + (dy - 0.5 * exp(min(d_log_h, max_delta_log_wh))) * box_h`` -`x1_new = ctr_x + (dx + 0.5 * exp(min(d_log_w, max_delta_log_wh))) * box_w - 1.0` +``x1_new = ctr_x + (dx + 0.5 * exp(min(d_log_w, max_delta_log_wh))) * box_w - 1.0`` -`y1_new = ctr_y + (dy + 0.5 * exp(min(d_log_h, max_delta_log_wh))) * box_h - 1.0` +``y1_new = ctr_y + (dy + 0.5 * exp(min(d_log_h, max_delta_log_wh))) * box_h - 1.0`` -* `box_w` and `box_h` are width and height of box, respectively: +* ``box_w`` and ``box_h`` are width and height of box, respectively: -`box_w = x1 - x0 + 1.0` +``box_w = x1 - x0 + 1.0`` -`box_h = y1 - y0 + 1.0` +``box_h = y1 - y0 + 1.0`` -* `ctr_x` and `ctr_y` are center location of a box: +* ``ctr_x`` and ``ctr_y`` are center location of a box: -`ctr_x = x0 + 0.5f * box_w` +``ctr_x = x0 + 0.5f * box_w`` -`ctr_y = y0 + 0.5f * box_h` +``ctr_y = y0 + 0.5f * box_h`` -* `dx`, `dy`, `d_log_w` and `d_log_h` are deltas calculated according to the formulas below, and `deltas_tensor` is a +* ``dx``, ``dy``, ``d_log_w`` and ``d_log_h`` are deltas calculated according to the formulas below, and ``deltas_tensor`` is a second input: -`dx = deltas_tensor[roi_idx, 4 * class_idx + 0] / deltas_weights[0]` +``dx = deltas_tensor[roi_idx, 4 * class_idx + 0] / deltas_weights[0]`` -`dy = deltas_tensor[roi_idx, 4 * class_idx + 1] / deltas_weights[1]` +``dy = deltas_tensor[roi_idx, 4 * class_idx + 1] / deltas_weights[1]`` -`d_log_w = deltas_tensor[roi_idx, 4 * class_idx + 2] / deltas_weights[2]` +``d_log_w = deltas_tensor[roi_idx, 4 * class_idx + 2] / deltas_weights[2]`` -`d_log_h = deltas_tensor[roi_idx, 4 * class_idx + 3] / deltas_weights[3]` +``d_log_h = deltas_tensor[roi_idx, 4 * class_idx + 3] / deltas_weights[3]`` -2. If *class_agnostic_box_regression* is `true` removes predictions for background classes. -3. Clips boxes to the image. -4. Applies *score_threshold* on detection scores. -5. Applies non-maximum suppression class-wise with *nms_threshold* and returns *post_nms_count* or less detections per -class. -6. Returns *max_detections_per_image* detections if total number of detections is more than *max_detections_per_image*; -otherwise, returns total number of detections and the output tensor is filled with undefined values for rest output -tensor elements. +2. If *class_agnostic_box_regression* is ``true`` removes predictions for background classes. +3. Clips boxes to the image. +4. Applies *score_threshold* on detection scores. +5. Applies non-maximum suppression class-wise with *nms_threshold* and returns *post_nms_count* or less detections per class. +6. Returns *max_detections_per_image* detections if total number of detections is more than *max_detections_per_image*; otherwise, returns total number of detections and the output tensor is filled with undefined values for rest output tensor elements. **Attributes**: @@ -59,7 +58,7 @@ tensor elements. * **Description**: The *score_threshold* attribute specifies a threshold to consider only detections whose score are larger than the threshold. * **Range of values**: non-negative floating-point number - * **Type**: float + * **Type**: ``float`` * **Default value**: None * **Required**: *yes* @@ -67,7 +66,7 @@ tensor elements. * **Description**: The *nms_threshold* attribute specifies a threshold to be used in the NMS stage. * **Range of values**: non-negative floating-point number - * **Type**: float + * **Type**: ``float`` * **Default value**: None * **Required**: *yes* @@ -75,7 +74,7 @@ tensor elements. * **Description**: The *num_classes* attribute specifies the number of detected classes. * **Range of values**: non-negative integer number - * **Type**: int + * **Type**: ``int`` * **Default value**: None * **Required**: *yes* @@ -83,7 +82,7 @@ tensor elements. * **Description**: The *post_nms_count* attribute specifies the maximal number of detections per class. * **Range of values**: non-negative integer number - * **Type**: int + * **Type**: ``int`` * **Default value**: None * **Required**: *yes* @@ -91,18 +90,18 @@ tensor elements. * **Description**: The *max_detections_per_image* attribute specifies maximal number of detections per image. * **Range of values**: non-negative integer number - * **Type**: int + * **Type**: ``int`` * **Default value**: None * **Required**: *yes* * *class_agnostic_box_regression* - * **Description**: *class_agnostic_box_regression* attribute is a flag that specifies whether to delete background - classes or not. + * **Description**: *class_agnostic_box_regression* attribute is a flag that specifies whether to delete background classes or not. * **Range of values**: - * `true` means background classes should be deleted - * `false` means background classes should not be deleted - * **Type**: boolean + + * ``true`` means background classes should be deleted + * ``false`` means background classes should not be deleted + * **Type**: ``boolean`` * **Default value**: false * **Required**: *no* @@ -110,7 +109,7 @@ tensor elements. * **Description**: The *max_delta_log_wh* attribute specifies maximal delta of logarithms for width and height. * **Range of values**: floating-point number - * **Type**: float + * **Type**: ``float`` * **Default value**: None * **Required**: *yes* @@ -118,76 +117,68 @@ tensor elements. * **Description**: The *deltas_weights* attribute specifies weights for bounding boxes sizes deltas. * **Range of values**: a list of non-negative floating-point numbers - * **Type**: float[] + * **Type**: ``float[]`` * **Default value**: None * **Required**: *yes* **Inputs** -* **1**: A 2D tensor of type *T* with input ROIs, with shape `[number_of_ROIs, 4]` providing the ROIs as 4-tuples: -[x1, y1, x2, y2]. The batch dimension of first, second, and third inputs -should be the same. **Required.** - -* **2**: A 2D tensor of type *T* with shape `[number_of_ROIs, num_classes * 4]` providing deltas for input boxes. - **Required.** - -* **3**: A 2D tensor of type *T* with shape `[number_of_ROIs, num_classes]` providing detections scores. **Required.** - -* **4**: A 2D tensor of type *T* with shape `[1, 3]` contains three elements - `[image_height, image_width, scale_height_and_width]` providing input image size info. **Required.** +* **1**: A 2D tensor of type *T* with input ROIs, with shape ``[number_of_ROIs, 4]`` providing the ROIs as 4-tuples: [x 1, y 1, x 2, y 2]. The batch dimension of first, second, and third inputs should be the same. **Required.** +* **2**: A 2D tensor of type *T* with shape ``[number_of_ROIs, num_classes * 4]`` providing deltas for input boxes. **Required.** +* **3**: A 2D tensor of type *T* with shape ``[number_of_ROIs, num_classes]`` providing detections scores. **Required.** +* **4**: A 2D tensor of type *T* with shape ``[1, 3]`` contains three elements ``[image_height, image_width, scale_height_and_width]`` providing input image size info. **Required.** **Outputs** -* **1**: A 2D tensor of type *T* with shape `[max_detections_per_image, 4]` providing boxes indices. - -* **2**: A 1D tensor of type *T_IND* with shape `[max_detections_per_image]` providing classes indices. - -* **3**: A 1D tensor of type *T* with shape `[max_detections_per_image]` providing scores indices. +* **1**: A 2D tensor of type *T* with shape ``[max_detections_per_image, 4]`` providing boxes indices. +* **2**: A 1D tensor of type *T_IND* with shape ``[max_detections_per_image]`` providing classes indices. +* **3**: A 1D tensor of type *T* with shape ``[max_detections_per_image]`` providing scores indices. **Types** * *T*: any supported floating-point type. - -* *T_IND*: `int64` or `int32`. - +* *T_IND*: ``int64`` or ``int32``. **Example** -```xml - - - - - 1000 - 4 - - - 1000 - 324 - - - 1000 - 81 - - - 1 - 3 - - - - - 100 - 4 - - - 100 - - - 100 - - - 100 - - - -``` +.. code-block:: cpp + + + + + + 1000 + 4 + + + 1000 + 324 + + + 1000 + 81 + + + 1 + 3 + + + + + 100 + 4 + + + 100 + + + 100 + + + 100 + + + + +@endsphinxdirective + diff --git a/docs/ops/detection/ExperimentalDetectronGenerateProposalsSingleImage_6.md b/docs/ops/detection/ExperimentalDetectronGenerateProposalsSingleImage_6.md index 5a9ec0b5b967d7..64c9e5ccca9396 100644 --- a/docs/ops/detection/ExperimentalDetectronGenerateProposalsSingleImage_6.md +++ b/docs/ops/detection/ExperimentalDetectronGenerateProposalsSingleImage_6.md @@ -1,75 +1,69 @@ # ExperimentalDetectronGenerateProposalsSingleImage {#openvino_docs_ops_detection_ExperimentalDetectronGenerateProposalsSingleImage_6} +@sphinxdirective + **Versioned name**: *ExperimentalDetectronGenerateProposalsSingleImage-6* **Category**: *Object detection* -**Short description**: The *ExperimentalDetectronGenerateProposalsSingleImage* operation computes ROIs and their scores -based on input data. +**Short description**: The *ExperimentalDetectronGenerateProposalsSingleImage* operation computes ROIs and their scores based on input data. **Detailed description**: The operation performs the following steps: -1. Transposes and reshapes predicted bounding boxes deltas and scores to get them into the same order as the anchors. -2. Transforms anchors into proposals using deltas and clips proposals to an image. -3. Removes predicted boxes with either height or width < *min_size*. -4. Sorts all `(proposal, score)` pairs by score from highest to lowest; order of pairs with equal scores is undefined. -5. Takes top *pre_nms_count* proposals, if total number of proposals is less than *pre_nms_count* takes all proposals. -6. Applies non-maximum suppression with *nms_threshold*. -7. Takes top *post_nms_count* proposals and returns these top proposals and their scores. If total number of proposals -is less than *post_nms_count* returns output tensors filled with zeroes. +1. Transposes and reshapes predicted bounding boxes deltas and scores to get them into the same order as the anchors. +2. Transforms anchors into proposals using deltas and clips proposals to an image. +3. Removes predicted boxes with either height or width < *min_size*. +4. Sorts all ``(proposal, score)`` pairs by score from highest to lowest; order of pairs with equal scores is undefined. +5. Takes top *pre_nms_count* proposals, if total number of proposals is less than *pre_nms_count* takes all proposals. +6. Applies non-maximum suppression with *nms_threshold*. +7. Takes top *post_nms_count* proposals and returns these top proposals and their scores. If total number of proposals is less than *post_nms_count* returns output tensors filled with zeroes. **Attributes**: * *min_size* - * **Description**: The *min_size* attribute specifies minimum box width and height. - * **Range of values**: non-negative floating-point number - * **Type**: float - * **Default value**: None - * **Required**: *yes* + * **Description**: The *min_size* attribute specifies minimum box width and height. + * **Range of values**: non-negative floating-point number + * **Type**: ``float`` + * **Default value**: None + * **Required**: *yes* * *nms_threshold* - * **Description**: The *nms_threshold* attribute specifies threshold to be used in the NMS stage. - * **Range of values**: non-negative floating-point number - * **Type**: float - * **Default value**: None - * **Required**: *yes* + * **Description**: The *nms_threshold* attribute specifies threshold to be used in the NMS stage. + * **Range of values**: non-negative floating-point number + * **Type**: ``float`` + * **Default value**: None + * **Required**: *yes* * *pre_nms_count* - * **Description**: The *pre_nms_count* attribute specifies number of top-n proposals before NMS. - * **Range of values**: non-negative integer number - * **Type**: int - * **Default value**: None - * **Required**: *yes* + * **Description**: The *pre_nms_count* attribute specifies number of top-n proposals before NMS. + * **Range of values**: non-negative integer number + * **Type**: ``int`` + * **Default value**: None + * **Required**: *yes* * *post_nms_count* - * **Description**: The *post_nms_count* attribute specifies number of top-n proposals after NMS. - * **Range of values**: non-negative integer number - * **Type**: int - * **Default value**: None - * **Required**: *yes* + * **Description**: The *post_nms_count* attribute specifies number of top-n proposals after NMS. + * **Range of values**: non-negative integer number + * **Type**: ``int`` + * **Default value**: None + * **Required**: *yes* **Inputs** -* **1**: A 1D tensor of type *T* with 3 elements `[image_height, image_width, scale_height_and_width]` providing input -image size info. **Required.** - -* **2**: A 2D tensor of type *T* with shape `[height * width * number_of_channels, 4]` providing anchors. **Required.** - -* **3**: A 3D tensor of type *T* with shape `[number_of_channels * 4, height, width]` providing deltas for anchors. +* **1**: A 1D tensor of type *T* with 3 elements ``[image_height, image_width, scale_height_and_width]`` providing input image size info. **Required.** +* **2**: A 2D tensor of type *T* with shape ``[height * width * number_of_channels, 4]`` providing anchors. **Required.** +* **3**: A 3D tensor of type *T* with shape ``[number_of_channels * 4, height, width]`` providing deltas for anchors. Height and width for third and fourth inputs should be equal. **Required.** - -* **4**: A 3D tensor of type *T* with shape `[number_of_channels, height, width]` providing proposals scores. -**Required.** +* **4**: A 3D tensor of type *T* with shape ``[number_of_channels, height, width]`` providing proposals scores. **Required.** **Outputs** -* **1**: A 2D tensor of type *T* with shape `[post_nms_count, 4]` providing ROIs. - -* **2**: A 1D tensor of type *T* with shape `[post_nms_count]` providing ROIs scores. +* **1**: A 2D tensor of type *T* with shape ``[post_nms_count, 4]`` providing ROIs. +* **2**: A 1D tensor of type *T* with shape ``[post_nms_count]`` providing ROIs scores. **Types** @@ -77,36 +71,39 @@ Height and width for third and fourth inputs should be equal. **Required.** **Example** -```xml - - - - - 3 - - - 12600 - 4 - - - 12 - 50 - 84 - - - 3 - 50 - 84 - - - - - 1000 - 4 - - - 1000 - - - -``` +.. code-block:: cpp + + + + + + 3 + + + 12600 + 4 + + + 12 + 50 + 84 + + + 3 + 50 + 84 + + + + + 1000 + 4 + + + 1000 + + + + +@endsphinxdirective + diff --git a/docs/ops/detection/ExperimentalDetectronPriorGridGenerator_6.md b/docs/ops/detection/ExperimentalDetectronPriorGridGenerator_6.md index 336d6b5d52f6f4..62ddba5f461bc7 100644 --- a/docs/ops/detection/ExperimentalDetectronPriorGridGenerator_6.md +++ b/docs/ops/detection/ExperimentalDetectronPriorGridGenerator_6.md @@ -1,83 +1,73 @@ # ExperimentalDetectronPriorGridGenerator {#openvino_docs_ops_detection_ExperimentalDetectronPriorGridGenerator_6} +@sphinxdirective + **Versioned name**: *ExperimentalDetectronPriorGridGenerator-6* **Category**: *Object detection* **Short description**: The *ExperimentalDetectronPriorGridGenerator* operation generates prior grids of specified sizes. -**Detailed description**: The operation takes coordinates of centres of boxes and adds strides with offset `0.5` to them to -calculate coordinates of prior grids. +**Detailed description**: The operation takes coordinates of centres of boxes and adds strides with offset `0.5` to them to calculate coordinates of prior grids. -Numbers of generated cells is `featmap_height` and `featmap_width` if *h* and *w* are zeroes; otherwise, *h* and *w*, -respectively. Steps of generated grid are `image_height` / `layer_height` and `image_width` / `layer_width` if -*stride_h* and *stride_w* are zeroes; otherwise, *stride_h* and *stride_w*, respectively. +Numbers of generated cells is ``featmap_height`` and ``featmap_width`` if *h* and *w* are zeroes; otherwise, *h* and *w*, respectively. Steps of generated grid are ``image_height`` / ``layer_height`` and ``image_width`` / ``layer_width`` if *stride_h* and *stride_w* are zeroes; otherwise, *stride_h* and *stride_w*, respectively. -`featmap_height`, `featmap_width`, `image_height` and `image_width` are spatial dimensions values from second and third -inputs, respectively. +``featmap_height``, ``featmap_width``, ``image_height`` and ``image_width`` are spatial dimensions values from second and third inputs, respectively. **Attributes**: * *flatten* - * **Description**: The *flatten* attribute specifies whether the output tensor should be 2D or 4D. - * **Range of values**: - * `true` - the output tensor should be a 2D tensor - * `false` - the output tensor should be a 4D tensor - * **Type**: boolean - * **Default value**: true - * **Required**: *no* + * **Description**: The *flatten* attribute specifies whether the output tensor should be 2D or 4D. + * **Range of values**: + + * ``true`` - the output tensor should be a 2D tensor + * ``false`` - the output tensor should be a 4D tensor + * **Type**: ``boolean`` + * **Default value**: true + * **Required**: *no* * *h* - * **Description**: The *h* attribute specifies number of cells of the generated grid with respect to height. - * **Range of values**: non-negative integer number less or equal than `featmap_height` - * **Type**: int - * **Default value**: 0 - * **Required**: *no* + * **Description**: The *h* attribute specifies number of cells of the generated grid with respect to height. + * **Range of values**: non-negative integer number less or equal than ``featmap_height`` + * **Type**: ``int`` + * **Default value**: 0 + * **Required**: *no* * *w* - * **Description**: The *w* attribute specifies number of cells of the generated grid with respect to width. - * **Range of values**: non-negative integer number less or equal than `featmap_width` - * **Type**: int - * **Default value**: 0 - * **Required**: *no* + * **Description**: The *w* attribute specifies number of cells of the generated grid with respect to width. + * **Range of values**: non-negative integer number less or equal than ``featmap_width`` + * **Type**: ``int`` + * **Default value**: 0 + * **Required**: *no* * *stride_x* - * **Description**: The *stride_x* attribute specifies the step of generated grid with respect to x coordinate. - * **Range of values**: non-negative float number - * **Type**: float - * **Default value**: 0.0 - * **Required**: *no* + * **Description**: The *stride_x* attribute specifies the step of generated grid with respect to x coordinate. + * **Range of values**: non-negative float number + * **Type**: ``float`` + * **Default value**: 0.0 + * **Required**: *no* * *stride_y* - * **Description**: The *stride_y* attribute specifies the step of generated grid with respect to y coordinate. - * **Range of values**: non-negative float number - * **Type**: float - * **Default value**: 0.0 - * **Required**: *no* + * **Description**: The *stride_y* attribute specifies the step of generated grid with respect to y coordinate. + * **Range of values**: non-negative float number + * **Type**: ``float`` + * **Default value**: 0.0 + * **Required**: *no* **Inputs** -* **1**: A 2D tensor of type *T* with shape `[number_of_priors, 4]` contains priors. **Required.** - -* **2**: A 4D tensor of type *T* with input feature map `[1, number_of_channels, featmap_height, featmap_width]`. This -operation uses only sizes of this input tensor, not its data.**Required.** - -* **3**: A 4D tensor of type *T* with input image `[1, number_of_channels, image_height, image_width]`. The number of -channels of both feature map and input image tensors must match. This operation uses only sizes of this input tensor, -not its data. **Required.** +* **1**: A 2D tensor of type *T* with shape ``[number_of_priors, 4]`` contains priors. **Required.** +* **2**: A 4D tensor of type *T* with input feature map ``[1, number_of_channels, featmap_height, featmap_width]``. This operation uses only sizes of this input tensor, not its data.**Required.** +* **3**: A 4D tensor of type *T* with input image ``[1, number_of_channels, image_height, image_width]``. The number of channels of both feature map and input image tensors must match. This operation uses only sizes of this input tensor, not its data. **Required.** **Outputs** -* **1**: A tensor of type *T* with priors grid with shape `[featmap_height * featmap_width * number_of_priors, 4]` -if flatten is `true` or `[featmap_height, featmap_width, number_of_priors, 4]`, otherwise. -If 0 < *h* < `featmap_height` and/or 0 < *w* < `featmap_width` the output data size is less than -`featmap_height` * `featmap_width` * `number_of_priors` * 4 and the output tensor is filled with undefined values for -rest output tensor elements. +* **1**: A tensor of type *T* with priors grid with shape ``[featmap_height * featmap_width * number_of_priors, 4]`` if flatten is ``true`` or ``[featmap_height, featmap_width, number_of_priors, 4]``, otherwise. If 0 < *h* < ``featmap_height`` and/or 0 < *w* < ``featmap_width`` the output data size is less than ``featmap_height`` * ``featmap_width`` * ``number_of_priors`` * 4 and the output tensor is filled with undefined values for rest output tensor elements. **Types** @@ -85,32 +75,35 @@ rest output tensor elements. **Example** -```xml - - - - - 3 - 4 - - - 1 - 256 - 25 - 42 - - - 1 - 3 - 800 - 1344 - - - - - 3150 - 4 - - - -``` +.. code-block:: cpp + + + + + + 3 + 4 + + + 1 + 256 + 25 + 42 + + + 1 + 3 + 800 + 1344 + + + + + 3150 + 4 + + + + +@endsphinxdirective + diff --git a/docs/ops/detection/ExperimentalDetectronROIFeatureExtractor_6.md b/docs/ops/detection/ExperimentalDetectronROIFeatureExtractor_6.md index fb67a6fafe9fc3..ad4a10e7e6f5c4 100644 --- a/docs/ops/detection/ExperimentalDetectronROIFeatureExtractor_6.md +++ b/docs/ops/detection/ExperimentalDetectronROIFeatureExtractor_6.md @@ -1,88 +1,75 @@ # ExperimentalDetectronROIFeatureExtractor {#openvino_docs_ops_detection_ExperimentalDetectronROIFeatureExtractor_6} +@sphinxdirective + **Versioned name**: *ExperimentalDetectronROIFeatureExtractor-6* **Category**: *Object detection* -**Short description**: *ExperimentalDetectronROIFeatureExtractor* is the [ROIAlign](ROIAlign_3.md) operation applied -over a feature pyramid. +**Short description**: *ExperimentalDetectronROIFeatureExtractor* is the :doc:`ROIAlign ` operation applied over a feature pyramid. -**Detailed description**: *ExperimentalDetectronROIFeatureExtractor* maps input ROIs to the levels of the pyramid -depending on the sizes of ROIs and parameters of the operation, and then extracts features via ROIAlign from -corresponding pyramid levels. +**Detailed description**: *ExperimentalDetectronROIFeatureExtractor* maps input ROIs to the levels of the pyramid depending on the sizes of ROIs and parameters of the operation, and then extracts features via ROIAlign from corresponding pyramid levels. Operation applies the *ROIAlign* algorithm to the pyramid layers: -`output[i, :, :, :] = ROIAlign(inputPyramid[j], rois[i])` +``output[i, :, :, :] = ROIAlign(inputPyramid[j], rois[i])`` -`j = PyramidLevelMapper(rois[i])` +``j = PyramidLevelMapper(rois[i])`` PyramidLevelMapper maps the ROI to the pyramid level using the following formula: -`j = floor(2 + log2(sqrt(w * h) / 224)` +``j = floor(2 + log2(sqrt(w * h) / 224)`` -Here 224 is the canonical ImageNet pre-training size, 2 is the pyramid starting level, and `w`, `h` are the ROI width and height. +Here 224 is the canonical ImageNet pre-training size, 2 is the pyramid starting level, and ``w``, ``h`` are the ROI width and height. -For more details please see the following source: -[Feature Pyramid Networks for Object Detection](https://arxiv.org/pdf/1612.03144.pdf). +For more details please see the following source: `Feature Pyramid Networks for Object Detection `__. **Attributes**: * *output_size* - * **Description**: The *output_size* attribute specifies the width and height of the output tensor. - * **Range of values**: a positive integer number - * **Type**: int - * **Default value**: None - * **Required**: *yes* + * **Description**: The *output_size* attribute specifies the width and height of the output tensor. + * **Range of values**: a positive integer number + * **Type**: ``int`` + * **Default value**: None + * **Required**: *yes* * *sampling_ratio* - * **Description**: The *sampling_ratio* attribute specifies the number of sampling points per the output value. If 0, - then use adaptive number computed as `ceil(roi_width / output_width)`, and likewise for height. - * **Range of values**: a non-negative integer number - * **Type**: int - * **Default value**: None - * **Required**: *yes* + * **Description**: The *sampling_ratio* attribute specifies the number of sampling points per the output value. If 0, then use adaptive number computed as ``ceil(roi_width / output_width)``, and likewise for height. + * **Range of values**: a non-negative integer number + * **Type**: ``int`` + * **Default value**: None + * **Required**: *yes* * *pyramid_scales* - * **Description**: The *pyramid_scales* enlists `image_size / layer_size[l]` ratios for pyramid layers `l=1,...,L`, - where `L` is the number of pyramid layers, and `image_size` refers to network's input image. Note that pyramid's - largest layer may have smaller size than input image, e.g. `image_size` is `800 x 1344` in the XML example below. - * **Range of values**: a list of positive integer numbers - * **Type**: int[] - * **Default value**: None - * **Required**: *yes* + * **Description**: The *pyramid_scales* enlists ``image_size / layer_size[l]`` ratios for pyramid layers ``l=1,...,L``, where ``L`` is the number of pyramid layers, and ``image_size`` refers to network's input image. Note that pyramid's largest layer may have smaller size than input image, e.g. ``image_size`` is ``800 x 1344`` in the XML example below. + * **Range of values**: a list of positive integer numbers + * **Type**: ``int[]`` + * **Default value**: None + * **Required**: *yes* * *aligned* - * **Description**: The *aligned* attribute specifies add offset (`-0.5`) to ROIs sizes or not. - * **Range of values**: - * `true` - add offset to ROIs sizes - * `false` - do not add offset to ROIs sizes - * **Type**: boolean - * **Default value**: false - * **Required**: *no* + * **Description**: The *aligned* attribute specifies add offset (``-0.5``) to ROIs sizes or not. + * **Range of values**: + + * ``true`` - add offset to ROIs sizes + * ``false`` - do not add offset to ROIs sizes + * **Type**: boolean + * **Default value**: false + * **Required**: *no* **Inputs**: -* **1**: 2D input tensor of type *T* with shape `[number_of_ROIs, 4]` providing the ROIs as 4-tuples: -[x1, y1, x2, y2]. Coordinates *x* and *y* are refer to the network's input -*image_size*. **Required.** - -* **2**, ..., **L**: Pyramid of 4D input tensors with feature maps. Shape must be -`[1, number_of_channels, layer_size[l], layer_size[l]]`. The number of channels must be the same for all layers of the -pyramid. The layer width and height must equal to the `layer_size[l] = image_size / pyramid_scales[l]`. **Required.** +* **1**: 2D input tensor of type *T* with shape ``[number_of_ROIs, 4]`` providing the ROIs as 4-tuples: [x 1, y 1, x2, y2]. Coordinates *x* and *y* are refer to the network's input *image_size*. **Required.** +* **2**, ..., **L**: Pyramid of 4D input tensors with feature maps. Shape must be ``[1, number_of_channels, layer_size[l], layer_size[l]]``. The number of channels must be the same for all layers of the pyramid. The layer width and height must equal to the ``layer_size[l] = image_size / pyramid_scales[l]``. **Required.** **Outputs**: -* **1**: 4D output tensor of type *T* with ROIs features. Shape must be -`[number_of_ROIs, number_of_channels, output_size, output_size]`. Channels number is the same as for all images in the -input pyramid. - -* **2**: 2D output tensor of type *T* with reordered ROIs according to their mapping to the pyramid levels. Shape -must be the same as for 1 input: `[number_of_ROIs, 4]`. +* **1**: 4D output tensor of type *T* with ROIs features. Shape must be ``[number_of_ROIs, number_of_channels, output_size, output_size]``. Channels number is the same as for all images in the input pyramid. +* **2**: 2D output tensor of type *T* with reordered ROIs according to their mapping to the pyramid levels. Shape must be the same as for 1 input: ``[number_of_ROIs, 4]``. **Types** @@ -90,50 +77,53 @@ must be the same as for 1 input: `[number_of_ROIs, 4]`. **Example** -```xml - - - - - 1000 - 4 - - - 1 - 256 - 200 - 336 - - - 1 - 256 - 100 - 168 - - - 1 - 256 - 50 - 84 - - - 1 - 256 - 25 - 42 - - - - - 1000 - 256 - 7 - 7 - - - 1000 - 4 - - - -``` +.. code-block:: cpp + + + + + + 1000 + 4 + + + 1 + 256 + 200 + 336 + + + 1 + 256 + 100 + 168 + + + 1 + 256 + 50 + 84 + + + 1 + 256 + 25 + 42 + + + + + 1000 + 256 + 7 + 7 + + + 1000 + 4 + + + + +@endsphinxdirective + diff --git a/docs/ops/generation/Eye_9.md b/docs/ops/generation/Eye_9.md index 214827027db41c..7fd6f516fb358f 100644 --- a/docs/ops/generation/Eye_9.md +++ b/docs/ops/generation/Eye_9.md @@ -1,4 +1,6 @@ -## Eye {#openvino_docs_ops_generation_Eye_9} +# Eye {#openvino_docs_ops_generation_Eye_9} + +@sphinxdirective **Versioned name**: *Eye-9* @@ -8,51 +10,51 @@ **Detailed description**: -*Eye* operation generates an identity matrix or a batch matrices with ones on the diagonal and zeros everywhere else. The index of the diagonal to be populated with ones is given by `diagonal_index`: `output[..., i, i + diagonal_index] = 1`. - - -Example 1. *Eye* output with `output_type` = `i32`: - -``` -num_rows = 3 - -num_columns = 4 - -diagonal_index = 2 - -output = [[0 0 1 0] - [0 0 0 1] - [0 0 0 0]] -``` - -Example 2. *Eye* output with `output_type` = `i32`: - -``` -num_rows = 3 - -num_columns = 4 - -diagonal_index = -1 - -output = [[0 0 0 0] - [1 0 0 0] - [0 1 0 0]] -``` - -Example 3. *Eye* output with `output_type` = `f16`: - -``` -num_rows = 2 - -diagonal_index = 5 - -batch_shape = [1, 2] - -output = [[[[0. 0.] - [0. 0.]] - [[0. 0.] - [0. 0.]]]] -``` +*Eye* operation generates an identity matrix or a batch matrices with ones on the diagonal and zeros everywhere else. The index of the diagonal to be populated with ones is given by ``diagonal_index``: ``output[..., i, i + diagonal_index] = 1``. + + +Example 1. *Eye* output with ``output_type`` = ``i32``: + +.. code-block:: cpp + + num_rows = 3 + + num_columns = 4 + + diagonal_index = 2 + + output = [[0 0 1 0] + [0 0 0 1] + [0 0 0 0]] + +Example 2. *Eye* output with ``output_type`` = ``i32``: + +.. code-block:: cpp + + num_rows = 3 + + num_columns = 4 + + diagonal_index = -1 + + output = [[0 0 0 0] + [1 0 0 0] + [0 1 0 0]] + +Example 3. *Eye* output with ``output_type`` = ``f16``: + +.. code-block:: cpp + + num_rows = 2 + + diagonal_index = 5 + + batch_shape = [1, 2] + + output = [[[[0. 0.] + [0. 0.]] + [[0. 0.] + [0. 0.]]]] **Attributes**: @@ -60,68 +62,68 @@ output = [[[[0. 0.] * **Description**: the type of the output * **Range of values**: any numeric type - * **Type**: string + * **Type**: ``string`` * **Required**: *Yes* **Inputs**: -* **1**: `num_rows` - scalar or 1D tensor with 1 non-negative element of type *T_NUM* describing the number of rows in matrix. **Required.** - -* **2**: `num_columns` - scalar or 1D tensor with 1 non-negative element of type *T_NUM* describing the number of columns in matrix. **Required.** - -* **3**: `diagonal_index` - scalar or 1D tensor with element of type *T_NUM* describing the index of the diagonal to be populated. A positive value refers to an upper diagonal and a negative value refers to a lower diagonal. Value `0` populates the main diagonal. If `diagonal_index` is a positive value and is not smaller than `num_rows` or if `diagonal_index` is a negative value and is not larger than `num_columns`, the matrix will be filled with only zeros. **Required.** - -* **4**: `batch_shape` - 1D tensor with non-negative values of type *T_NUM* defines leading batch dimensions of output shape. If `batch_shape` is an empty list, *Eye* operation generates a 2D tensor (matrix). This input is optional, and its default value equal to an empty tensor. +* **1**: ``num_rows`` - scalar or 1D tensor with 1 non-negative element of type *T_NUM* describing the number of rows in matrix. **Required.** +* **2**: ``num_columns`` - scalar or 1D tensor with 1 non-negative element of type *T_NUM* describing the number of columns in matrix. **Required.** +* **3**: ``diagonal_index`` - scalar or 1D tensor with element of type *T_NUM* describing the index of the diagonal to be populated. A positive value refers to an upper diagonal and a negative value refers to a lower diagonal. Value ``0`` populates the main diagonal. If ``diagonal_index`` is a positive value and is not smaller than ``num_rows`` or if ``diagonal_index`` is a negative value and is not larger than ``num_columns``, the matrix will be filled with only zeros. **Required.** +* **4**: ``batch_shape`` - 1D tensor with non-negative values of type *T_NUM* defines leading batch dimensions of output shape. If ``batch_shape`` is an empty list, *Eye* operation generates a 2D tensor (matrix). This input is optional, and its default value equal to an empty tensor. **Outputs**: -* **1**: A tensor with the type specified by the *output_type* attribute. The shape is `batch_shape + [num_rows, num_columns]` +* **1**: A tensor with the type specified by the *output_type* attribute. The shape is ``batch_shape + [num_rows, num_columns]`` **Types** -* *T_NUM*: `int32` or `int64`. +* *T_NUM*: ``int32`` or ``int64``. **Examples** *Example 1* -```xml - - - - - - - - - - 5 - 5 - - - -``` +.. code-block:: cpp + + + + + < !-- num rows: 5 --> + < !-- num columns: 5 --> + < !-- diagonal index --> + + + + 5 + 5 + + + *Example 2* -```xml - - - - - - - - - - - 2 - 3 - -1 - -1 - - - -``` +.. code-block:: cpp + + + + + < !-- num rows --> + < !-- num columns --> + < !-- diagonal index --> + < !-- batch_shape : [2, 3] --> + + + + 2 + 3 + -1 + -1 + + + + +@endsphinxdirective + diff --git a/docs/ops/infrastructure/Assign_3.md b/docs/ops/infrastructure/Assign_3.md index 0fc8c7c40557b6..2af130576ad702 100644 --- a/docs/ops/infrastructure/Assign_3.md +++ b/docs/ops/infrastructure/Assign_3.md @@ -33,7 +33,7 @@ declared in ``variable_id`` and returns an error otherwise. **Example** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/matrix/Einsum_7.md b/docs/ops/matrix/Einsum_7.md index 2e4325dc685bbf..5ceb079e604435 100644 --- a/docs/ops/matrix/Einsum_7.md +++ b/docs/ops/matrix/Einsum_7.md @@ -1,5 +1,7 @@ # Einsum {#openvino_docs_ops_matrix_Einsum_7} +@sphinxdirective + **Versioned name**: *Einsum-7* **Category**: *Matrix multiplication* @@ -9,17 +11,17 @@ **Detailed description**: *Einsum* can represent many common multidimensional linear algebraic tensor operations: matrix multiplication; inner (or dot), outer and cross products; transpose; trace and diagonal extraction. Also, a single *Einsum* operation can express complex combination of these common linear algebraic tensor operations on multiple operands, -for example, a dot product of a diagonal, extracted from a tensor with shape `[5, 5]`, and 5D vector is performed by single Einsum operation. -The Einstein summation convention on input tensors is defined by `equation`, which is a mandatory attribute of *Einsum* operation. -The operation supports `equation` in explicit and implicit modes. The formats of `equation` in both modes are described below. +for example, a dot product of a diagonal, extracted from a tensor with shape ``[5, 5]``, and 5D vector is performed by single Einsum operation. +The Einstein summation convention on input tensors is defined by ``equation``, which is a mandatory attribute of *Einsum* operation. +The operation supports ``equation`` in explicit and implicit modes. The formats of ``equation`` in both modes are described below. -In explicit mode, the einsum `equation` has the output subscript separated from the input subscripts by `->`, and has the following format for `n` operands: -`, , ..., -> `. -Each input subscript `` contains a sequence of labels (alphabetic letters `['A',...,'Z','a',...,'z']`), +In explicit mode, the einsum ``equation`` has the output subscript separated from the input subscripts by ``->``, and has the following format for ``n`` operands: +``, , ..., -> ``. +Each input subscript ```` contains a sequence of labels (alphabetic letters ``['A',...,'Z','a',...,'z']``), where each label refers to a dimension of the corresponsing operand. Labels are case sensitive and capital letters precede lowercase letters in alphabetical sort. Labels do not need to appear in a subscript in alphabetical order. -The subscript for a scalar input is empty. The input subscripts are separated with a comma `,`. -The output subscript `` represents a sequence of labels (alphabetic letters `['A',...,'Z','a',...,'z']`). +The subscript for a scalar input is empty. The input subscripts are separated with a comma ``,``. +The output subscript ```` represents a sequence of labels (alphabetic letters ``['A',...,'Z','a',...,'z']``). The length of an input subscript matches a rank of the input. The input subscript is empty for a scalar input. *Einsum* operation on multiple inputs can be treated as several consecutive *Einsum* operations. In the first step, *Einsum* applies the first two inputs. @@ -27,145 +29,132 @@ In the second step, it operates on the result of the first step and the third in *Einsum* operates on two operands similar to element-wise multiplication by all pairs of batches from both operands. The batch dimensions are defined with labels belonging to only one of the two input subscripts. -For example, the intermediate result after the first step for *Einsum* with three inputs of shapes `[2, 5]`, `[5, 3, 6]` and `[5, 3]`, -and `equation` equal to `ab,bcd,bc->ca` will be a tensor of shape `[2, 5, 3, 6]` with a subscript `abcd`, -where batch dimensions for the first input and the second input are represented with label sequences `a` and `cd`. -The next step performs the same logic on input tensors of shapes `[2, 5, 3, 6]` and `[5, 3]` with subscripts `abcd` and `bc`, and -outputs a tensor of shape `[2, 5, 3, 6]` with a subscript `abcd`. +For example, the intermediate result after the first step for *Einsum* with three inputs of shapes ``[2, 5]``, ``[5, 3, 6]`` and ``[5, 3]``, +and ``equation`` equal to ``ab,bcd,bc->ca`` will be a tensor of shape ``[2, 5, 3, 6]`` with a subscript ``abcd``, +where batch dimensions for the first input and the second input are represented with label sequences ``a`` and ``cd``. +The next step performs the same logic on input tensors of shapes ``[2, 5, 3, 6]`` and ``[5, 3]`` with subscripts ``abcd`` and ``bc``, and +outputs a tensor of shape ``[2, 5, 3, 6]`` with a subscript ``abcd``. Lastly, the output subscript defines the order of output dimensions, and sum-reduced dimensions. -Dimensions corresponding to absent labels in the output subscript are sum-reduced. The final result for the considered example is of shape equal to `[3,2]`, -where dimensions with labels `b` and `d` are reduced, and the transpose is applied to get output layout `ca`. - -**NOTE**: *Einsum* operation can perform on a single operand. In this case, the operation can transpose the input and reduce its dimensions. - -**NOTE**: Input ranks must be equal to the length of corresponding subscripts. Dimensions with the same corresponding labels in input subscripts -must be equal in size. - -**NOTE**: A label can be repeated in the same input subscript, for example, `equation` equal to `aac,abd,ddde`. In this case, the corresponding dimensions -must match in size, and the operand is replaced by its diagonal along these dimensions. -For example, *Einsum* operation on the single 3D tensor of shape `[2, 4, 5, 4]` with `equation` equal to `ijkj->ij`. +Dimensions corresponding to absent labels in the output subscript are sum-reduced. The final result for the considered example is of shape equal to ``[3,2]``, +where dimensions with labels ``b`` and ``d`` are reduced, and the transpose is applied to get output layout ``ca``. -**NOTE**: The specification considers the primitive algorithm for *Einsum* operation for better understanding of the operation -and does not recommend it for implementation. - -**NOTE**: The described algorithm can be improved by immediate dimension sum-reduction of the intermediate results if the corresponding labels are absent -in the input subscripts of subsequent inputs and the output subscript. It can significantly boost performance and reduce memory costs. -In the considered example, after the first step you can reduce the dimension corresponding to the label `d`. +.. note:: + + * *Einsum* operation can perform on a single operand. In this case, the operation can transpose the input and reduce its dimensions. + * Input ranks must be equal to the length of corresponding subscripts. Dimensions with the same corresponding labels in input subscripts must be equal in size. + * A label can be repeated in the same input subscript, for example, ``equation`` equal to ``aac,abd,ddde``. In this case, the corresponding dimensions must match in size, and the operand is replaced by its diagonal along these dimensions. For example, *Einsum* operation on the single 3D tensor of shape ``[2, 4, 5, 4]`` with ``equation`` equal to ``ijkj->ij``. + * The specification considers the primitive algorithm for *Einsum* operation for better understanding of the operation and does not recommend it for implementation. + * The described algorithm can be improved by immediate dimension sum-reduction of the intermediate results if the corresponding labels are absent in the input subscripts of subsequent inputs and the output subscript. It can significantly boost performance and reduce memory costs. In the considered example, after the first step you can reduce the dimension corresponding to the label ``d``. The output shape is computed by concatenation of dimension sizes to which labels in the output subscript correspond in the specified order. Example 1 shows how *Einsum* computes inner product of two 1D tensors: -``` -a1 = [1.0, 2.0, 3.0] -a2 = [4.0, 5.0, 6.0] -equation = "i,i->" -output = 32.0 -``` +.. code-block:: cpp + + a1 = [1.0, 2.0, 3.0] + a2 = [4.0, 5.0, 6.0] + equation = "i,i->" + output = 32.0 Example 2 shows how *Einsum* computes matrix-vector multiplication: -``` -A = [[1.0, 2.0, 3.0], - [1.0, 2.0, 3.0]] -b = [4.0, 5.0, 6.0] -equation = "ij,j->i" -output = [32.0, 32.0] -``` +.. code-block:: cpp + + A = [[1.0, 2.0, 3.0], + [1.0, 2.0, 3.0]] + b = [4.0, 5.0, 6.0] + equation = "ij,j->i" + output = [32.0, 32.0] Example 3 shows how *Einsum* computes a trace for each batch object: -``` -A = [[[1.0, 2.0, 3.0], - [4.0, 5.0, 6.0], - [7.0, 8.0, 9.0]], - [[2.0, 4.0, 6.0], - [8.0, 10.0, 12.0], - [14.0, 16.0, 18.0]]] -equation = "kii->k" -output = [15.0, 30.0] -``` +.. code-block:: cpp + + A = [[[1.0, 2.0, 3.0], + [4.0, 5.0, 6.0], + [7.0, 8.0, 9.0]], + [[2.0, 4.0, 6.0], + [8.0, 10.0, 12.0], + [14.0, 16.0, 18.0]]] + equation = "kii->k" + output = [15.0, 30.0] Example 4 shows how *Einsum* extracts a diagonal for each batch object: -``` -A = [[[1.0, 2.0, 3.0], - [4.0, 5.0, 6.0], - [7.0, 8.0, 9.0]], - [[2.0, 4.0, 6.0], - [8.0, 10.0, 12.0], - [14.0, 16.0, 18.0]]] -equation = "kii->ki" -output = [[1.0, 5.0, 9.0], - [2.0, 10.0, 18.0]] -``` +.. code-block:: cpp + + A = [[[1.0, 2.0, 3.0], + [4.0, 5.0, 6.0], + [7.0, 8.0, 9.0]], + [[2.0, 4.0, 6.0], + [8.0, 10.0, 12.0], + [14.0, 16.0, 18.0]]] + equation = "kii->ki" + output = [[1.0, 5.0, 9.0], + [2.0, 10.0, 18.0]] Example 5 shows how *Einsum* transposes input tensor: -``` -A = [[[1.0, 2.0, 3.0], - [4.0, 5.0, 6.0], - [7.0, 8.0, 9.0]]] -equation = "ijk->kij" -output = [[[1.0, 4.0, 7.0]], - [[2.0, 5.0, 8.0]], - [[3.0, 6.0, 9.0]]] -``` - -In addition to an alphabetic label, ellipsis `...` can be used as a label in a subscript to cover broadcasted dimensions. -Each input subscript can contain at most one ellipsis. For example, the ellipsis in input subscript `a...bc` for five rank tensor covers -the second and third dimensions. In case input subscripts contain ellipsis for several operands, the dimensions covered by the ellipsis -must be broadcastable to satisfy numpy broadcasting (or multidirectional broadcasting) rules available in -[Broadcast Rules For Elementwise Operations](../broadcast_rules.md). -If at least one input subscript contains an ellipsis, the output subscript must always contain one ellipsis. -For example, *Einsum* operation on two inputs of shapes `[9, 1, 4, 3]` and `[3, 11, 7, 1]` with `equation="a...b,b...->a..."` -has ellipsis for both operands covering dimensions with sizes `[1, 4]` and `[11, 7, 1]` that are broadcasted to `[11, 7, 4]`. -The resulted shape of *Einsum* operation will be `[9, 11, 7, 4]` since the dimension labeled with `a` is left with broadcasted dimensions. +.. code-block:: cpp + + A = [[[1.0, 2.0, 3.0], + [4.0, 5.0, 6.0], + [7.0, 8.0, 9.0]]] + equation = "ijk->kij" + output = [[[1.0, 4.0, 7.0]], + [[2.0, 5.0, 8.0]], + [[3.0, 6.0, 9.0]]] + + +In addition to an alphabetic label, ellipsis ``...`` can be used as a label in a subscript to cover broadcasted dimensions. Each input subscript can contain at most one ellipsis. For example, the ellipsis in input subscript ``a...bc`` for five rank tensor covers the second and third dimensions. In case input subscripts contain ellipsis for several operands, the dimensions covered by the ellipsis must be broadcastable to satisfy numpy broadcasting (or multidirectional broadcasting) rules available in :doc:`Broadcast Rules For Elementwise Operations `. If at least one input subscript contains an ellipsis, the output subscript must always contain one ellipsis. For example, *Einsum* operation on two inputs of shapes ``[9, 1, 4, 3]`` and ``[3, 11, 7, 1]`` with ``equation="a...b,b...->a..."`` has ellipsis for both operands covering dimensions with sizes ``[1, 4]`` and ``[11, 7, 1]`` that are broadcasted to ``[11, 7, 4]``. The resulted shape of *Einsum* operation will be ``[9, 11, 7, 4]`` since the dimension labeled with ``a`` is left with broadcasted dimensions. Example 6 shows how *Einsum* operates on the single input with an equation containing ellipsis: -``` -A = [[1.0, 2.0, 3.0], - [4.0, 5.0, 6.0], - [7.0, 8.0, 9.0]] -equation = "a...->..." -output = [12.0, 15.0, 18.0] -``` +.. code-block:: cpp + + A = [[1.0, 2.0, 3.0], + [4.0, 5.0, 6.0], + [7.0, 8.0, 9.0]] + equation = "a...->..." + output = [12.0, 15.0, 18.0] Example 7 shows how *Einsum* operates with broadcasting two operands: -``` -A = [[1.0, 2.0, 3.0], - [4.0, 5.0, 6.0], - [7.0, 8.0, 9.0]] -B = [0.5] -equation = "a...,...->a..." -output = [[0.5, 1.0, 1.5], - [2.0, 2.5, 3.0], - [3.5, 4.0, 4.5]] -``` +.. code-block:: cpp + + A = [[1.0, 2.0, 3.0], + [4.0, 5.0, 6.0], + [7.0, 8.0, 9.0]] + B = [0.5] + equation = "a...,...->a..." + output = [[0.5, 1.0, 1.5], + [2.0, 2.5, 3.0], + [3.5, 4.0, 4.5]] In implicit mode (a classical form of Einstein summation), the equation does not have the output subscript and has the following format: -`, , ..., `. +``, , ..., ``. The equation in implicit mode consists of only input subscripts for each operand. The output subscript can be recovered as a sequence of alphabetically sorted labels that are not repeated in the left-hand side of the equation. -For example, `equation = "dbbc,ca"` in implicit mode is equivalent to `equation = "dbbc,ca->ad"` in explicit mode. -The equation in implicit mode can set up only subset of Einstein summation conventions. For example, `equation = "kii->i"` cannot be represented in implicit mode. +For example, ``equation = "dbbc,ca"`` in implicit mode is equivalent to ``equation = "dbbc,ca->ad"`` in explicit mode. +The equation in implicit mode can set up only subset of Einstein summation conventions. For example, ``equation = "kii->i"`` cannot be represented in implicit mode. In case ellipsis label is in the left-hand side of the equation in implicit mode, the ellipsis comes first in the output subscript for the recovery. Example 8 shows how *Einsum* operates with an equation containing both capital and lowercase letters in implicit mode -`equation = "AbC"` that is the same as `equation = "AbC->ACb"`: +``equation = "AbC"`` that is the same as ``equation = "AbC->ACb"``: -``` -A = [[[1.0, 2.0, 3.0], - [4.0, 5.0, 6.0]]] -equation = "AbC" -output = [[[1.0, 4.0], - [2.0, 5.0], - [3.0, 6.0]]] -``` +.. code-block:: cpp + + A = [[[1.0, 2.0, 3.0], + [4.0, 5.0, 6.0]]] + equation = "AbC" + output = [[[1.0, 4.0], + [2.0, 5.0], + [3.0, 6.0]]] -**NOTE**: The equation in both modes can contain blank space characters (U+0020) at any positions that can be removed without losing equivalence. +.. note:: + + The equation in both modes can contain blank space characters (U+0020) at any positions that can be removed without losing equivalence. **Attributes**: @@ -173,7 +162,7 @@ output = [[[1.0, 4.0], * **Description**: it defines Einstein summation convention on input operands. The equation must be in either explicit or implicit mode. * **Range of values**: the equation format is described above - * **Type**: string + * **Type**: ``string`` * **Required**: *yes* **Inputs**: @@ -182,7 +171,7 @@ output = [[[1.0, 4.0], **Output**: -* **1**: Tensor of type *T* and shape is computed based on the output subscript of the equation. +* **1**: Tensor of type *T* and shape is computed based on the output subscript of the equation. **Types** @@ -190,53 +179,56 @@ output = [[[1.0, 4.0], **Examples** -```xml - - - - - 2 - 64 - - - 2 - 64 - - - - - 2 - - - -``` - -```xml - - - - - 2 - 3 - 4 - - - 2 - 7 - 1 - - - 2 - 4 - 7 - - - - - 4 - 3 - 7 - - - -``` +.. code-block:: cpp + + + + + + 2 + 64 + + + 2 + 64 + + + + + 2 + + + + +.. code-block:: cpp + + + + + + 2 + 3 + 4 + + + 2 + 7 + 1 + + + 2 + 4 + 7 + + + + + 4 + 3 + 7 + + + + +@endsphinxdirective + diff --git a/docs/ops/movement/ExtractImagePatches_3.md b/docs/ops/movement/ExtractImagePatches_3.md index c312caac007be2..764f2a6bc71e08 100644 --- a/docs/ops/movement/ExtractImagePatches_3.md +++ b/docs/ops/movement/ExtractImagePatches_3.md @@ -8,9 +8,9 @@ **Detailed description**: -The *ExtractImagePatches* operation extracts patches of shape `sizes` which are `strides` apart in the input image. The output elements are taken from the input at intervals given by the `rate` argument, as in dilated convolutions. +The *ExtractImagePatches* operation extracts patches of shape ``sizes`` which are ``strides`` apart in the input image. The output elements are taken from the input at intervals given by the ``rate`` argument, as in dilated convolutions. -The result is a 4D tensor containing image patches with size `size[0] * size[1] * depth` vectorized in the "depth" dimension. +The result is a 4D tensor containing image patches with size ``size[0] * size[1] * depth`` vectorized in the "depth" dimension. The "auto_pad" attribute has no effect on the size of each patch, it determines how many patches are extracted. @@ -19,332 +19,355 @@ The "auto_pad" attribute has no effect on the size of each patch, it determines * *sizes* - * **Description**: *sizes* is a size `[size_rows, size_cols]` of the extracted patches. + * **Description**: *sizes* is a size ``[size_rows, size_cols]`` of the extracted patches. * **Range of values**: non-negative integer number - * **Type**: int[] + * **Type**: ``int[]`` * **Required**: *yes* * *strides* - * **Description**: *strides* is a distance `[stride_rows, stride_cols]` between centers of two consecutive patches in an input tensor. + * **Description**: *strides* is a distance ``[stride_rows, stride_cols]`` between centers of two consecutive patches in an input tensor. * **Range of values**: non-negative integer number - * **Type**: int[] + * **Type**: ``int[]`` * **Required**: *yes* * *rates* - * **Description**: *rates* is the input stride `[rate_rows, rate_cols]`, specifying how far two consecutive patch samples are in the input. Equivalent to extracting patches with `patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)`, followed by subsampling them spatially by a factor of rates. This is equivalent to rate in dilated (a.k.a. Atrous) convolutions. + * **Description**: *rates* is the input stride ``[rate_rows, rate_cols]``, specifying how far two consecutive patch samples are in the input. Equivalent to extracting patches with ``patch_sizes_eff = patch_sizes + (patch_sizes - 1) * (rates - 1)``, followed by subsampling them spatially by a factor of rates. This is equivalent to rate in dilated (a.k.a. Atrous) convolutions. * **Range of values**: non-negative integer number - * **Type**: int[] + * **Type**: ``int[]`` * **Required**: *yes* * *auto_pad* * **Description**: *auto_pad* how the padding is calculated. Possible values: + * *same_upper (same_lower)* the input is padded by zeros to match the output size. In case of odd padding value an extra padding is added at the end (at the beginning). * *valid* - do not use padding. - * **Type**: string + * **Type**: ``string`` * **Required**: *yes* **Inputs** -* **1**: `data` the 4-D tensor of type *T* with shape `[batch, depth, in_rows, in_cols]`. **Required.** +* **1**: ``data`` the 4-D tensor of type *T* with shape ``[batch, depth, in_rows, in_cols]``. **Required.** **Outputs** -* **1**: 4-D tensor with shape `[batch, size[0] * size[1] * depth, out_rows, out_cols]` with type equal to `data` tensor. Note `out_rows` and `out_cols` are the dimensions of the output patches. +* **1**: 4-D tensor with shape ``[batch, size[0] * size[1] * depth, out_rows, out_cols]`` with type equal to ``data`` tensor. Note ``out_rows`` and ``out_cols`` are the dimensions of the output patches. **Types** * *T*: any supported type. - **Example** -```xml - - - - - 64 - 3 - 10 - 10 - - - - - 64 - 27 - 2 - 2 - - - -``` - -Image is a `1 x 1 x 10 x 10` array that contains the numbers 1 through 100. We use the symbol `x` to mark output patches. - -1. `sizes="3,3", strides="5,5", rates="1,1", auto_pad="valid"` -\f[ - \begin{bmatrix} - x & x & x & 4 & 5 & x & x & x & 9 & 10 \\ - x & x & x & 14 & 15 & x & x & x & 19 & 20 \\ - x & x & x & 24 & 25 & x & x & x & 29 & 30 \\ - 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 \\ - 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 & 50 \\ - x & x & x & 54 & 55 & x & x & x & 59 & 60 \\ - x & x & x & 64 & 65 & x & x & x & 69 & 70 \\ - x & x & x & 74 & 75 & x & x & x & 79 & 80 \\ - 81 & 82 & 83 & 84 & 85 & 86 & 87 & 88 & 89 & 90 \\ - 91 & 92 & 93 & 94 & 95 & 96 & 79 & 98 & 99 & 100 - \end{bmatrix} -\f] - - output: -``` - [[[[ 1 6] - [51 56]] - - [[ 2 7] - [52 57]] - - [[ 3 8] - [53 58]] - - [[11 16] - [61 66]] - - [[12 17] - [62 67]] - - [[13 18] - [63 68]] - - [[21 26] - [71 76]] - - [[22 27] - [72 77]] - - [[23 28] - [73 78]]]] -``` - output shape: `[1, 9, 2, 2]` - -2. `sizes="4,4", strides="8,8", rates="1,1", auto_pad="valid"` -\f[ - \begin{bmatrix} - x & x & x & x & 5 & 6 & 7 & 8 & 9 & 10 \\ - x & x & x & x & 15 & 16 & 17 & 18 & 19 & 20 \\ - x & x & x & x & 25 & 26 & 27 & 28 & 29 & 30 \\ - x & x & x & x & 35 & 36 & 37 & 38 & 39 & 40 \\ - 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 & 50 \\ - 51 & 52 & 53 & 54 & 55 & 56 & 57 & 58 & 59 & 60 \\ - 61 & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 \\ - 71 & 72 & 73 & 74 & 75 & 76 & 77 & 78 & 79 & 80 \\ - 81 & 82 & 83 & 84 & 85 & 86 & 87 & 88 & 89 & 90 \\ - 91 & 92 & 93 & 94 & 95 & 96 & 79 & 98 & 99 & 100 - \end{bmatrix} -\f] - - output: -``` - [[[[ 1]] - - [[ 2]] - - [[ 3]] - - [[ 4]] - - [[11]] - - [[12]] - - [[13]] - - [[14]] - - [[21]] - - [[22]] - - [[23]] - - [[24]] - - [[31]] - - [[32]] - - [[33]] - - [[34]]]] -``` - output shape: `[1, 16, 1, 1]` - -3. `sizes="4,4", strides="9,9", rates="1,1", auto_pad="same_upper"` -\f[ - \begin{bmatrix} - x & x & x & x & 0 & 0 & 0 & 0 & 0 & x & x & x & x\\ - x & x & x & x & 4 & 5 & 6 & 7 & 8 & x & x & x & x\\ - x & x & x & x & 14 & 15 & 16 & 17 & 18 & x & x & x & x\\ - x & x & x & x & 24 & 25 & 26 & 27 & 28 & x & x & x & x\\ - 0 & 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 & 0 & 0\\ - 0 & 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 & 50 & 0 & 0\\ - 0 & 51 & 52 & 53 & 54 & 55 & 56 & 57 & 58 & 59 & 60 & 0 & 0\\ - 0 & 61 & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 0 & 0\\ - 0 & 71 & 72 & 73 & 74 & 75 & 76 & 77 & 78 & 79 & 80 & 0 & 0\\ - x & x & x & x & 84 & 85 & 86 & 87 & 88 & x & x & x & x\\ - x & x & x & x & 94 & 95 & 96 & 79 & 98 & x & x & x & x\\ - x & x & x & x & 0 & 0 & 0 & 0 & 0 & x & x & x & x\\ - x & x & x & x & 0 & 0 & 0 & 0 & 0 & x & x & x & x - \end{bmatrix} -\f] - output: -``` - [[[[ 0 0] - [ 0 89]] - - [[ 0 0] - [ 81 90]] - - [[ 0 0] - [ 82 0]] - - [[ 0 0] - [ 83 0]] - - [[ 0 9] - [ 0 99]] - - [[ 1 10] - [ 91 100]] - - [[ 2 0] - [ 92 0]] - - [[ 3 0] - [ 93 0]] - - [[ 0 19] - [ 0 0]] - - [[ 11 20] - [ 0 0]] - - [[ 12 0] - [ 0 0]] - - [[ 13 0] - [ 0 0]] - - [[ 0 29] - [ 0 0]] - - [[ 21 30] - [ 0 0]] - - [[ 22 0] - [ 0 0]] - - [[ 23 0] - [ 0 0]]]] -``` - output shape: `[1, 16, 2, 2]` +.. code-block:: cpp + + + + + + 64 + 3 + 10 + 10 + + + + + 64 + 27 + 2 + 2 + + + + +Image is a ``1 x 1 x 10 x 10`` array that contains the numbers 1 through 100. We use the symbol ``x`` to mark output patches. + +1. ``sizes="3,3", strides="5,5", rates="1,1", auto_pad="valid"`` + + .. math:: + + \begin{bmatrix} + x & x & x & 4 & 5 & x & x & x & 9 & 10 \\ + x & x & x & 14 & 15 & x & x & x & 19 & 20 \\ + x & x & x & 24 & 25 & x & x & x & 29 & 30 \\ + 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 \\ + 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 & 50 \\ + x & x & x & 54 & 55 & x & x & x & 59 & 60 \\ + x & x & x & 64 & 65 & x & x & x & 69 & 70 \\ + x & x & x & 74 & 75 & x & x & x & 79 & 80 \\ + 81 & 82 & 83 & 84 & 85 & 86 & 87 & 88 & 89 & 90 \\ + 91 & 92 & 93 & 94 & 95 & 96 & 79 & 98 & 99 & 100 + \end{bmatrix} + + + output: + + .. code-block:: cpp + + [[[[ 1 6] + [51 56]] + + [[ 2 7] + [52 57]] + + [[ 3 8] + [53 58]] + + [[11 16] + [61 66]] + + [[12 17] + [62 67]] + + [[13 18] + [63 68]] + + [[21 26] + [71 76]] + + [[22 27] + [72 77]] + + [[23 28] + [73 78]]]] + + output shape: `[1, 9, 2, 2]` + +2. ``sizes="4,4", strides="8,8", rates="1,1", auto_pad="valid"`` + + .. math:: + + \begin{bmatrix} + x & x & x & x & 5 & 6 & 7 & 8 & 9 & 10 \\ + x & x & x & x & 15 & 16 & 17 & 18 & 19 & 20 \\ + x & x & x & x & 25 & 26 & 27 & 28 & 29 & 30 \\ + x & x & x & x & 35 & 36 & 37 & 38 & 39 & 40 \\ + 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 & 50 \\ + 51 & 52 & 53 & 54 & 55 & 56 & 57 & 58 & 59 & 60 \\ + 61 & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 \\ + 71 & 72 & 73 & 74 & 75 & 76 & 77 & 78 & 79 & 80 \\ + 81 & 82 & 83 & 84 & 85 & 86 & 87 & 88 & 89 & 90 \\ + 91 & 92 & 93 & 94 & 95 & 96 & 79 & 98 & 99 & 100 + \end{bmatrix} + + + output: + + .. code-block:: cpp + + [[[[ 1]] + + [[ 2]] + + [[ 3]] + + [[ 4]] + + [[11]] + + [[12]] + + [[13]] + + [[14]] + + [[21]] + + [[22]] + + [[23]] + + [[24]] + + [[31]] + + [[32]] + + [[33]] + + [[34]]]] + + output shape: ``[1, 16, 1, 1]`` + +3. ``sizes="4,4", strides="9,9", rates="1,1", auto_pad="same_upper"`` + + .. math:: + + \begin{bmatrix} + x & x & x & x & 0 & 0 & 0 & 0 & 0 & x & x & x & x\\ + x & x & x & x & 4 & 5 & 6 & 7 & 8 & x & x & x & x\\ + x & x & x & x & 14 & 15 & 16 & 17 & 18 & x & x & x & x\\ + x & x & x & x & 24 & 25 & 26 & 27 & 28 & x & x & x & x\\ + 0 & 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 & 0 & 0\\ + 0 & 41 & 42 & 43 & 44 & 45 & 46 & 47 & 48 & 49 & 50 & 0 & 0\\ + 0 & 51 & 52 & 53 & 54 & 55 & 56 & 57 & 58 & 59 & 60 & 0 & 0\\ + 0 & 61 & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 & 0 & 0\\ + 0 & 71 & 72 & 73 & 74 & 75 & 76 & 77 & 78 & 79 & 80 & 0 & 0\\ + x & x & x & x & 84 & 85 & 86 & 87 & 88 & x & x & x & x\\ + x & x & x & x & 94 & 95 & 96 & 79 & 98 & x & x & x & x\\ + x & x & x & x & 0 & 0 & 0 & 0 & 0 & x & x & x & x\\ + x & x & x & x & 0 & 0 & 0 & 0 & 0 & x & x & x & x + \end{bmatrix} + + output: + + .. code-block:: cpp + + [[[[ 0 0] + [ 0 89]] + + [[ 0 0] + [ 81 90]] + + [[ 0 0] + [ 82 0]] + + [[ 0 0] + [ 83 0]] + + [[ 0 9] + [ 0 99]] + + [[ 1 10] + [ 91 100]] + + [[ 2 0] + [ 92 0]] + + [[ 3 0] + [ 93 0]] + + [[ 0 19] + [ 0 0]] + + [[ 11 20] + [ 0 0]] + + [[ 12 0] + [ 0 0]] + + [[ 13 0] + [ 0 0]] + + [[ 0 29] + [ 0 0]] + + [[ 21 30] + [ 0 0]] + + [[ 22 0] + [ 0 0]] + + [[ 23 0] + [ 0 0]]]] + + output shape: ``[1, 16, 2, 2]`` + +4. ``sizes="3,3", strides="5,5", rates="2,2", auto_pad="valid"`` + + This time we use the symbols ``x``, ``y``, ``z`` and ``k`` to distinguish the patches: + + .. math:: + + \begin{bmatrix} + x & 2 & x & 4 & x & y & 7 & y & 9 & y \\ + 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 \\ + x & 22 & x & 24 & x & y & 27 & y & 29 & y \\ + 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 \\ + x & 42 & x & 44 & x & y & 47 & y & 49 & y \\ + z & 52 & z & 54 & z & k & 57 & k & 59 & k \\ + 61 & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 \\ + z & 72 & z & 74 & z & k & 77 & k & 79 & k \\ + 81 & 82 & 83 & 84 & 85 & 86 & 87 & 88 & 89 & 90 \\ + z & 92 & z & 94 & z & k & 79 & k & 99 & k + \end{bmatrix} + + output: + + .. code-block:: cpp + + [[[[ 1 6] + [ 51 56]] + + [[ 3 8] + [ 53 58]] + + [[ 5 10] + [ 55 60]] + + [[ 21 26] + [ 71 76]] + + [[ 23 28] + [ 73 78]] + + [[ 25 30] + [ 75 80]] + + [[ 41 46] + [ 91 96]] + + [[ 43 48] + [ 93 98]] + + [[ 45 50] + [ 95 100]]]] + + output_shape: ``[1, 9, 2, 2]`` + +5. ``sizes="2,2", strides="3,3", rates="1,1", auto_pad="valid"`` + + Image is a ``1 x 2 x 5 x 5`` array that contains two feature maps where feature map with coordinate 0 contains numbers in a range ``[1, 25]`` and feature map with coordinate 1 contains numbers in a range ``[26, 50]`` + + .. math:: + + \begin{bmatrix} + x & x & 3 & x & x\\ + x & x & 8 & x & x\\ + 11 & 12 & 13 & 14 & 15\\ + x & x & 18 & x & x\\ + x & x & 23 & x & x + \end{bmatrix}\\ + \begin{bmatrix} + x & x & 28 & x & x\\ + x & x & 33 & x & x\\ + 36 & 37 & 38 & 39 & 40\\ + x & x & 43 & x & x\\ + x & x & 48 & x & x + \end{bmatrix} + + output: + + .. code-block:: cpp + + [[[[ 1 4] + [16 19]] + + [[26 29] + [41 44]] + + [[ 2 5] + [17 20]] + + [[27 30] + [42 45]] + + [[ 6 9] + [21 24]] + + [[31 34] + [46 49]] + + [[ 7 10] + [22 25]] + + [[32 35] + [47 50]]]] + + output shape: ``[1, 8, 2, 2]`` + +@endsphinxdirective -4. `sizes="3,3", strides="5,5", rates="2,2", auto_pad="valid"` -This time we use the symbols `x`, `y`, `z` and `k` to distinguish the patches: -\f[ - \begin{bmatrix} - x & 2 & x & 4 & x & y & 7 & y & 9 & y \\ - 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 & 19 & 20 \\ - x & 22 & x & 24 & x & y & 27 & y & 29 & y \\ - 31 & 32 & 33 & 34 & 35 & 36 & 37 & 38 & 39 & 40 \\ - x & 42 & x & 44 & x & y & 47 & y & 49 & y \\ - z & 52 & z & 54 & z & k & 57 & k & 59 & k \\ - 61 & 62 & 63 & 64 & 65 & 66 & 67 & 68 & 69 & 70 \\ - z & 72 & z & 74 & z & k & 77 & k & 79 & k \\ - 81 & 82 & 83 & 84 & 85 & 86 & 87 & 88 & 89 & 90 \\ - z & 92 & z & 94 & z & k & 79 & k & 99 & k - \end{bmatrix} -\f] - - output: -``` - [[[[ 1 6] - [ 51 56]] - - [[ 3 8] - [ 53 58]] - - [[ 5 10] - [ 55 60]] - - [[ 21 26] - [ 71 76]] - - [[ 23 28] - [ 73 78]] - - [[ 25 30] - [ 75 80]] - - [[ 41 46] - [ 91 96]] - - [[ 43 48] - [ 93 98]] - - [[ 45 50] - [ 95 100]]]] -``` - output_shape: `[1, 9, 2, 2]` - -5. `sizes="2,2", strides="3,3", rates="1,1", auto_pad="valid"` -Image is a `1 x 2 x 5 x 5` array that contains two feature maps where feature map with coordinate 0 contains numbers in a range `[1, 25]` and feature map with coordinate 1 contains numbers in a range `[26, 50]` - -\f[ - \begin{bmatrix} - x & x & 3 & x & x\\ - x & x & 8 & x & x\\ - 11 & 12 & 13 & 14 & 15\\ - x & x & 18 & x & x\\ - x & x & 23 & x & x - \end{bmatrix}\\ - \begin{bmatrix} - x & x & 28 & x & x\\ - x & x & 33 & x & x\\ - 36 & 37 & 38 & 39 & 40\\ - x & x & 43 & x & x\\ - x & x & 48 & x & x - \end{bmatrix} -\f] - output: -``` - [[[[ 1 4] - [16 19]] - - [[26 29] - [41 44]] - - [[ 2 5] - [17 20]] - - [[27 30] - [42 45]] - - [[ 6 9] - [21 24]] - - [[31 34] - [46 49]] - - [[ 7 10] - [22 25]] - - [[32 35] - [47 50]]]] -``` - output shape: `[1, 8, 2, 2]` diff --git a/docs/ops/pooling/AdaptiveAvgPool_8.md b/docs/ops/pooling/AdaptiveAvgPool_8.md index 08ac7b49c854ff..32e6ee098f3344 100644 --- a/docs/ops/pooling/AdaptiveAvgPool_8.md +++ b/docs/ops/pooling/AdaptiveAvgPool_8.md @@ -1,4 +1,4 @@ -## AdaptiveAvgPool {#openvino_docs_ops_pooling_AdaptiveAvgPool_8} +# AdaptiveAvgPool {#openvino_docs_ops_pooling_AdaptiveAvgPool_8} @sphinxdirective @@ -44,7 +44,7 @@ The output is calculated with the following formula: **Examples** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/pooling/AdaptiveMaxPool_8.md b/docs/ops/pooling/AdaptiveMaxPool_8.md index 8163646e409a09..37e46101f85102 100644 --- a/docs/ops/pooling/AdaptiveMaxPool_8.md +++ b/docs/ops/pooling/AdaptiveMaxPool_8.md @@ -1,4 +1,4 @@ -## AdaptiveMaxPool {#openvino_docs_ops_pooling_AdaptiveMaxPool_8} +# AdaptiveMaxPool {#openvino_docs_ops_pooling_AdaptiveMaxPool_8} @sphinxdirective @@ -55,7 +55,7 @@ The output is calculated following this formula: **Examples** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/pooling/AvgPool_1.md b/docs/ops/pooling/AvgPool_1.md index 46505bb066a20f..b5c222cc477a3b 100644 --- a/docs/ops/pooling/AvgPool_1.md +++ b/docs/ops/pooling/AvgPool_1.md @@ -94,7 +94,7 @@ **Examples** -.. code-block:: console +.. code-block:: cpp diff --git a/docs/ops/sort/ExperimentalDetectronTopKROIs_6.md b/docs/ops/sort/ExperimentalDetectronTopKROIs_6.md index 82e503735eab94..3b5e888152b842 100644 --- a/docs/ops/sort/ExperimentalDetectronTopKROIs_6.md +++ b/docs/ops/sort/ExperimentalDetectronTopKROIs_6.md @@ -1,5 +1,7 @@ # ExperimentalDetectronTopKROIs {#openvino_docs_ops_sort_ExperimentalDetectronTopKROIs_6} +@sphinxdirective + **Versioned name**: *ExperimentalDetectronTopKROIs-6* **Category**: *Sorting and maximization* @@ -16,22 +18,20 @@ output tensor elements. * *max_rois* - * **Description**: The *max_rois* attribute specifies maximal numbers of output ROIs. - * **Range of values**: non-negative integer number - * **Type**: int - * **Default value**: 0 - * **Required**: *no* + * **Description**: The *max_rois* attribute specifies maximal numbers of output ROIs. + * **Range of values**: non-negative integer number + * **Type**: ``int`` + * **Default value**: 0 + * **Required**: *no* **Inputs** -* **1**: A 2D tensor of type *T* with shape `[number_of_ROIs, 4]` describing the ROIs as 4-tuples: -[x1, y1, x2, y2]. **Required.** - -* **2**: A 1D tensor of type *T* with shape `[number_of_input_ROIs]` contains probabilities for input ROIs. **Required.** +* **1**: A 2D tensor of type *T* with shape ``[number_of_ROIs, 4]`` describing the ROIs as 4-tuples: [x 1, y 1, x 2, y 2]. **Required.** +* **2**: A 1D tensor of type *T* with shape ``[number_of_input_ROIs]`` contains probabilities for input ROIs. **Required.** **Outputs** -* **1**: A 2D tensor of type *T* with shape `[max_rois, 4]` describing *max_rois* ROIs with highest probabilities. +* **1**: A 2D tensor of type *T* with shape ``[max_rois, 4]`` describing *max_rois* ROIs with highest probabilities. **Types** @@ -39,23 +39,26 @@ output tensor elements. **Example** -```xml - - - - - 5000 - 4 - - - 5000 - - - - - 1000 - 4 - - - -``` +.. code-block:: cpp + + + + + + 5000 + 4 + + + 5000 + + + + + 1000 + 4 + + + + +@endsphinxdirective + diff --git a/docs/ops/sparse/EmbeddingBagOffsetsSum_3.md b/docs/ops/sparse/EmbeddingBagOffsetsSum_3.md index 08dabfe9530144..719fb2e4483f7e 100644 --- a/docs/ops/sparse/EmbeddingBagOffsetsSum_3.md +++ b/docs/ops/sparse/EmbeddingBagOffsetsSum_3.md @@ -1,62 +1,62 @@ # EmbeddingBagOffsetsSum {#openvino_docs_ops_sparse_EmbeddingBagOffsetsSum_3} +@sphinxdirective + **Versioned name**: *EmbeddingBagOffsetsSum-3* **Category**: *Sparse* **Short description**: Computes sums of "bags" of embeddings, without instantiating the intermediate embeddings. -**Detailed description**: This is the second case of the PyTorch [EmbeddingBag](https://pytorch.org/docs/stable/nn.html#embeddingbag), it has indices in two 1D tensors provided as 2nd and 3rd inputs. For each index in `indices` this operator gets values from `data` embedding table and sums all values belonging to each bag. Values in `offsets` define starting index in `indices` tensor of each "bag", e.g. `offsets` with value `[0,3,4,4,6]` define 5 "bags" containing `[3,1,0,2,n-6]` elements. +**Detailed description**: This is the second case of the PyTorch `EmbeddingBag `__ , it has indices in two 1D tensors provided as 2nd and 3rd inputs. For each index in ``indices`` this operator gets values from ``data`` embedding table and sums all values belonging to each bag. Values in ``offsets`` define starting index in ``indices`` tensor of each "bag", e.g. ``offsets`` with value ``[0,3,4,4,6]`` define 5 "bags" containing ``[3,1,0,2,n-6]`` elements. **Attributes**: EmbeddingBagOffsetsSum operation has no attributes. **Inputs**: -* **1**: `emb_table` tensor containing the embedding lookup table of the module of shape `[num_emb, emb_dim1, emb_dim2, ...]` and of type *T*. **Required.** - -* **2**: `indices` tensor of shape `[num_indices]` and of type *T_IND*. **Required.** - -* **3**: `offsets` tensor of shape `[batch]` and of type *T_IND* containing the starting index positions of each "bag" in `indices`. **Required.** - -* **4**: `default_index` scalar of type *T_IND* containing default index in embedding table to fill empty "bags". If not provided empty "bags" are filled with zeros. **Optional.** - -* **5**: `per_sample_weights` tensor of the same shape as `indices` and of type *T*. Each value in this tensor are multiplied with each value pooled from embedding table for each index. Optional, default is tensor of ones. +* **1**: ``emb_table`` tensor containing the embedding lookup table of the module of shape ``[num_emb, emb_dim1, emb_dim2, ...]`` and of type *T*. **Required.** +* **2**: ``indices`` tensor of shape ``[num_indices]`` and of type *T_IND*. **Required.** +* **3**: ``offsets`` tensor of shape ``[batch]`` and of type *T_IND* containing the starting index positions of each "bag" in ``indices``. **Required.** +* **4**: ``default_index`` scalar of type *T_IND* containing default index in embedding table to fill empty "bags". If not provided empty "bags" are filled with zeros. **Optional.** +* **5**: ``per_sample_weights`` tensor of the same shape as ``indices`` and of type *T*. Each value in this tensor are multiplied with each value pooled from embedding table for each index. Optional, default is tensor of ones. **Outputs**: -* **1**: tensor of shape `[batch, emb_dim1, emb_dim2, ...]` and of type *T* containing embeddings for each bag. +* **1**: tensor of shape ``[batch, emb_dim1, emb_dim2, ...]`` and of type *T* containing embeddings for each bag. **Types** * *T*: any numeric type. - -* *T_IND*: `int32` or `int64`. +* *T_IND*: ``int32`` or ``int64``. **Example** -```xml - - - - 5 - 2 - - - 4 - - - 3 - - - - 4 - - - - - 3 - 2 - - - -``` +.. code-block:: cpp + + + + < !-- emb_table value is: [[-0.2, -0.6], [-0.1, -0.4], [-1.9, -1.8], [-1., 1.5], [ 0.8, -0.7]] --> + 5 + 2 + + < !-- indices value is: [0, 2, 3, 4] --> + 4 + + < !-- offsets value is: [0, 2, 2] - 3 "bags" containing [2,0,4-2] elements, second "bag" is empty --> + 3 + + < !-- default_index value is: 0 --> + < !-- per_sample_weigths value is: [0.5, 0.5, 0.5, 0.5] --> + 4 + + + + < !-- output value is: [[-1.05, -1.2], [-0.2, -0.6], [-0.1, 0.4]] --> + 3 + 2 + + + + +@endsphinxdirective + diff --git a/docs/ops/sparse/EmbeddingBagPackedSum_3.md b/docs/ops/sparse/EmbeddingBagPackedSum_3.md index 745b217e9005b3..4906c1d10ea81b 100644 --- a/docs/ops/sparse/EmbeddingBagPackedSum_3.md +++ b/docs/ops/sparse/EmbeddingBagPackedSum_3.md @@ -1,56 +1,58 @@ # EmbeddingBagPackedSum {#openvino_docs_ops_sparse_EmbeddingBagPackedSum_3} +@sphinxdirective + **Versioned name**: *EmbeddingBagPackedSum-3* **Category**: *Sparse* **Short description**: Computes sums of "bags" of embeddings, without instantiating the intermediate embeddings. -**Detailed description**: This is the first case of the PyTorch [EmbeddingBag](https://pytorch.org/docs/stable/nn.html#embeddingbag), it has indices in the tensor of format `[batch, indices_per_bag]`. If 3rd input is not provided, this operation is equivalent to *Gather* followed by *ReduceSum(axis=0)*. However, *EmbeddingBagPackedSum* is much more time and memory efficient than using a chain of these operations. +**Detailed description**: This is the first case of the PyTorch `EmbeddingBag `__ , it has indices in the tensor of format ``[batch, indices_per_bag]``. If 3rd input is not provided, this operation is equivalent to *Gather* followed by *ReduceSum(axis=0)*. However, *EmbeddingBagPackedSum* is much more time and memory efficient than using a chain of these operations. **Attributes**: EmbeddingBagPackedSum operation has no attributes. **Inputs**: -* **1**: `emb_table` tensor containing the embedding lookup table of the module of shape `[num_emb, emb_dim1, emb_dim2, ...]` and of type *T*. **Required.** - -* **2**: `indices` tensor of shape `[batch, indices_per_bag]` and of type *T_IND*. **Required.** - -* **3**: `per_sample_weights` tensor of the same shape as `indices` and of type *T*. Each value in this tensor are multiplied with each value pooled from embedding table for each index. Optional, default is tensor of ones. +* **1**: ``emb_table`` tensor containing the embedding lookup table of the module of shape ``[num_emb, emb_dim1, emb_dim2, ...]`` and of type *T*. **Required.** +* **2**: ``indices`` tensor of shape ``[batch, indices_per_bag]`` and of type *T_IND*. **Required.** +* **3**: ``per_sample_weights`` tensor of the same shape as ``indices`` and of type *T*. Each value in this tensor are multiplied with each value pooled from embedding table for each index. Optional, default is tensor of ones. **Outputs**: -* **1**: tensor of shape `[batch, emb_dim1, emb_dim2, ...]` and of type *T* containing embeddings for each bag. +* **1**: tensor of shape ``[batch, emb_dim1, emb_dim2, ...]`` and of type *T* containing embeddings for each bag. **Types** * *T*: any numeric type. - -* *T_IND*: `int32` or `int64`. +* *T_IND*: ``int32`` or ``int64``. **Example** -```xml - - - - 5 - 2 - - - 3 - 2 - - - 3 - 2 - - - - - 3 - 2 - - - -``` +.. code-block:: cpp + + + + < !-- emb_table value is: [[-0.2, -0.6], [-0.1, -0.4], [-1.9, -1.8], [-1., 1.5], [ 0.8, -0.7]] --> + 5 + 2 + + < !-- indices value is: [[0, 2], [1, 2], [3, 4]] --> + 3 + 2 + + < !-- per_sample_weigths value is: [[0.5, 0.5], [0.5, 0.5], [0.5, 0.5]] --> + 3 + 2 + + + + < !-- output value is: [[-1.05, -1.2], [-1., -1.1], [-0.1, 0.4]] --> + 3 + 2 + + + + +@endsphinxdirective + diff --git a/docs/ops/sparse/EmbeddingSegmentsSum_3.md b/docs/ops/sparse/EmbeddingSegmentsSum_3.md index 828c268a59ba9c..54d6ccdce745a7 100644 --- a/docs/ops/sparse/EmbeddingSegmentsSum_3.md +++ b/docs/ops/sparse/EmbeddingSegmentsSum_3.md @@ -1,65 +1,64 @@ # EmbeddingSegmentsSum {#openvino_docs_ops_sparse_EmbeddingSegmentsSum_3} +@sphinxdirective + **Versioned name**: *EmbeddingSegmentsSum-3* **Category**: *Sparse* **Short description**: Computes sums of segments of embeddings, without instantiating the intermediate embeddings. -**Detailed description**: This is [sparse.segment_sum](https://www.tensorflow.org/api_docs/python/tf/sparse/segment_sum) operation from Tensorflow. For each index in `indices` this operator gets values from `data` embedding table and sums all values belonging to each segment. Values in `segment_ids` define which segment index in `indices` tensor belong to, e.g. `segments_ids` with value `[0,0,0,1,1,3,5,5]` define 4 non empty segments other segments are empty, the number of segments is defined by `num_segments` input. +**Detailed description**: This is `sparse.segment_sum `__ operation from Tensorflow. For each index in ``indices`` this operator gets values from ``data`` embedding table and sums all values belonging to each segment. Values in ``segment_ids`` define which segment index in ``indices`` tensor belong to, e.g. ``segments_ids`` with value ``[0,0,0,1,1,3,5,5]`` define 4 non empty segments other segments are empty, the number of segments is defined by ``num_segments`` input. **Attributes**: EmbeddingSegmentsSum operation has no attributes. **Inputs**: -* **1**: `emb_table` tensor containing the embedding lookup table of the module of shape `[num_emb, emb_dim1, emb_dim2, ...]` and of type *T*. **Required.** - -* **2**: `indices` tensor of shape `[num_indices]` and of type *T_IND*. **Required.** - -* **3**: `segment_ids` tensor of shape `[num_indices]` and of type *T_IND* with indices into the output Tensor. Values should be sorted and can be repeated. **Required.** - -* **4**: `num_segments` scalar of type *T_IND* indicating the number of segments. **Required.** - -* **5**: `default_index` scalar of type *T_IND* containing default index in embedding table to fill empty segments. If not provided empty segments are filled with zeros. **Optional.** - -* **6**: `per_sample_weights` tensor of the same shape as `indices` and of type *T*. Each value in this tensor are multiplied with each value pooled from embedding table for each index. Optional, default is tensor of ones. +* **1**: ``emb_table`` tensor containing the embedding lookup table of the module of shape ``[num_emb, emb_dim1, emb_dim2, ...]`` and of type *T*. **Required.** +* **2**: ``indices`` tensor of shape ``[num_indices]`` and of type *T_IND*. **Required.** +* **3**: ``segment_ids`` tensor of shape ``[num_indices]`` and of type *T_IND* with indices into the output Tensor. Values should be sorted and can be repeated. **Required.** +* **4**: ``num_segments`` scalar of type *T_IND* indicating the number of segments. **Required.** +* **5**: ``default_index`` scalar of type *T_IND* containing default index in embedding table to fill empty segments. If not provided empty segments are filled with zeros. **Optional.** +* **6**: ``per_sample_weights`` tensor of the same shape as ``indices`` and of type *T*. Each value in this tensor are multiplied with each value pooled from embedding table for each index. Optional, default is tensor of ones. **Outputs**: -* **1**: tensor of shape `[num_segments, emb_dim1, emb_dim2, ...]` and of type *T* containing embeddings for each bag. +* **1**: tensor of shape ``[num_segments, emb_dim1, emb_dim2, ...]`` and of type *T* containing embeddings for each bag. **Types** * *T*: any numeric type. - -* *T_IND*: `int32` or `int64`. +* *T_IND*: ``int32`` or ``int64``. **Example** -```xml - - - - 5 - 2 - - - 4 - - - 4 - - - - - 4 - - - - - 3 - 2 - - - -``` +.. code-block:: cpp + + + + < !-- emb_table value is: [[-0.2, -0.6], [-0.1, -0.4], [-1.9, -1.8], [-1., 1.5], [ 0.8, -0.7]] --> + 5 + 2 + + < !-- indices value is: [0, 2, 3, 4] --> + 4 + + < !-- segment_ids value is: [0, 0, 2, 2] - second segment is empty --> + 4 + + < !-- num_segments value is: 3 --> + < !-- default_index value is: 0 --> + < !-- per_sample_weigths value is: [0.5, 0.5, 0.5, 0.5] --> + 4 + + + + < !-- output value is: [[-1.05, -1.2], [-0.2, -0.6], [-0.1, 0.4]] --> + 3 + 2 + + + + +@endsphinxdirective +