Reverse

Versioned name: Reverse-1

Category: data movement operation

Short description: Reverse operations reverse specified axis in an input tensor.

Detailed description: Reverse produces a tensor with the same shape as the first input tensor and with elements reversed along dimensions specified in the second input tensor. The axes can be represented either by dimension indices or as a mask. The interpretation of the second input is determined by mode attribute.

If index mode is used, the second tensor should contain indices of axes that should be reversed. The length of the second tensor should be in a range from 0 to rank of the 1st input tensor.

In case if mask mode is used, then the second input tensor length should be equal to the rank of the 1st input. And each value has boolean value True or False. True means the corresponding axes should be reverted, False means it should be untouched.

If no axis specified, that means either the second input is empty if index mode is used or second input has only False elements if mask mode is used, then Reverse just passes the source tensor through output not doing any data movements.

Attributes

Inputs:

Outputs:

Types

Example

<layer ... type="Reverse">
<data mode="index"/>
<input>
<port id="0">
<dim>3</dim>
<dim>10</dim>
<dim>100</dim>
<dim>200</dim>
</port>
<port id="1">
<dim>1</dim>
</port>
</input>
<output>
<port id="2">
<dim>3</dim>
<dim>10</dim>
<dim>100</dim>
<dim>200</dim>
</port>
</output>
</layer>