Skip to content

Commit

Permalink
ReverseSequence specification refactored (#7112)
Browse files Browse the repository at this point in the history
* ReverseSequence specification refactored

* Change attribute description to avoid confusion

* Allow seq_lenghts input to be of floating-point precision
  • Loading branch information
ggalieroc authored Aug 20, 2021
1 parent afd49e6 commit 211ea3c
Showing 1 changed file with 26 additions and 16 deletions.
42 changes: 26 additions & 16 deletions docs/ops/movement/ReverseSequence_1.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,65 @@

**Versioned name**: *ReverseSequence-1*

**Category**: data movement operation
**Category**: *Data movement*

**Short description**: *ReverseSequence* reverses variable length slices of data.

**Detailed description**: *ReverseSequence* slices input along the dimension specified in the *batch_axis*, and for each slice *i*, reverses the first *lengths[i]* (the second input) elements along the dimension specified in the *seq_axis*.
**Detailed description**

*ReverseSequence* slices a given input tensor `data` along the dimension specified in the *batch_axis* attribute. For each slice `i`, it reverses the first `seq_lengths[i]` elements along the dimension specified in the *seq_axis* attribute.

**Attributes**

* *batch_axis*

* **Description**: *batch_axis* is the index of the batch dimension.
* **Range of values**: an integer. Can be negative.
* **Description**: *batch_axis* is the index of the batch dimension along which `data` input tensor is sliced.
* **Range of values**: an integer within the range `[-rank(data), rank(data) - 1]`
* **Type**: `int`
* **Default value**: 0
* **Default value**: `0`
* **Required**: *no*

* *seq_axis*

* **Description**: *seq_axis* is the index of the sequence dimension.
* **Range of values**: an integer. Can be negative.
* **Description**: *seq_axis* is the index of the sequence dimension along which elements of `data` input tensor are reversed.
* **Range of values**: an integer within the range `[-rank(data), rank(data) - 1]`
* **Type**: `int`
* **Default value**: 1
* **Default value**: `1`
* **Required**: *no*

**Inputs**:
**Inputs**

* **1**: `data` - Input data to reverse. A tensor of type *T1* and rank greater or equal to 2. **Required.**
* **2**: `seq_lengths` - Sequence lengths to reverse in the input tensor `data`. A 1D tensor comprising `data_shape[batch_axis]` elements of type *T2*. All element values must be integer values within the range `[1, data_shape[seq_axis]]`. Value `1` means, no elements are reversed. **Required.**

**Outputs**

* **1**: tensor with input data to reverse. **Required.**
* **1**: The result of slice and reverse `data` input tensor. A tensor of type *T1* and the same shape as `data` input tensor.

* **2**: 1D tensor populated with integers with sequence lengths in the 1st input tensor. **Required.**
**Types**

* *T1*: any supported type.
* *T2*: any supported numerical type.

**Example**

```xml
<layer ... type="ReverseSequence">
<data batch_axis="0" seq_axis="1"/>
<input>
<port id="0">
<dim>3</dim>
<dim>10</dim>
<port id="0"> <!-- data -->
<dim>4</dim> <!-- batch_axis -->
<dim>10</dim> <!-- seq_axis -->
<dim>100</dim>
<dim>200</dim>
</port>
<port id="1">
<dim>3</dim>
<dim>4</dim> <!-- seq_lengths value: [2, 4, 8, 10] -->
</port>
</input>
<output>
<port id="2">
<dim>3</dim>
<dim>4</dim>
<dim>10</dim>
<dim>100</dim>
<dim>200</dim>
Expand Down

0 comments on commit 211ea3c

Please sign in to comment.