2021-12-21 20:26:37 +03:00
# Transpose {#openvino_docs_ops_movement_Transpose_1}
2020-06-19 14:39:57 +03:00
**Versioned name** : *Transpose-1*
2021-08-23 12:12:46 +02:00
**Category** : *Data movement*
2020-06-19 14:39:57 +03:00
**Short description** : *Transpose* operation reorders the input tensor dimensions.
2021-07-02 12:51:00 +02:00
**Detailed description** : *Transpose* operation reorders the input tensor dimensions. Source indexes and destination indexes are bound by the formula:
2021-04-22 14:31:06 +02:00
\f[output[i(order[0]), i(order[1]), ..., i(order[N-1])] = input[i(0), i(1), ..., i(N-1)]\\ \quad \textrm{where} \quad i(j) \quad\textrm{is in the range} \quad [0, (input.shape[j]-1)]\f]
2020-06-19 14:39:57 +03:00
2021-04-22 14:31:06 +02:00
**Attributes** : *Transpose* operation has no attributes.
2020-06-19 14:39:57 +03:00
**Inputs** :
2021-07-02 12:51:00 +02:00
* **1**: `arg` - the tensor to be transposed. A tensor of type *T* and arbitrary shape. **Required.**
* **2**: `input_order` - the permutation to apply to the axes of the first input shape. A 1D tensor of `n` elements *T_AXIS* type and shape `[n]` , where `n` is the rank of the first input or `0` . The tensor's value must contain every integer in the range `[0, n-1]` , but if an empty tensor is specified (shape `[0]` ), then the axes will be inverted. **Required.**
2020-06-19 14:39:57 +03:00
**Outputs** :
2021-07-02 12:51:00 +02:00
* **1** : A tensor of type *T* and transposed shape according to the rules specified above.
2020-06-19 14:39:57 +03:00
**Types**
2021-04-22 14:31:06 +02:00
* *T*: any supported type.
* *T_AXIS*: any integer type.
2020-06-19 14:39:57 +03:00
**Examples**
*Example 1*
```xml
<layer ... type= "Transpose" >
<input>
<port id= "0" >
<dim> 2</dim>
<dim> 3</dim>
<dim> 4</dim>
</port>
<port id= "1" >
<dim> 3</dim> <!-- [2, 0, 1] -->
</port>
</input>
<output>
<port id= "2" >
<dim> 4</dim>
<dim> 2</dim>
<dim> 3</dim>
</port>
</output>
</layer>
```
2021-04-22 14:31:06 +02:00
*Example 2: input_order = empty 1D tensor of Shape[0]
2020-06-19 14:39:57 +03:00
```xml
<layer ... type= "Transpose" >
<input>
<port id= "0" >
<dim> 2</dim>
<dim> 3</dim>
<dim> 4</dim>
</port>
<port id= "1" >
2021-04-22 14:31:06 +02:00
<dim> 0</dim> <!-- input_order is an empty 1D tensor -->
2020-06-19 14:39:57 +03:00
</port>
</input>
2021-07-02 12:51:00 +02:00
<output>
2020-06-19 14:39:57 +03:00
<port id= "2" >
<dim> 4</dim>
<dim> 3</dim>
<dim> 2</dim>
</port>
</output>
</layer>
2021-07-02 12:51:00 +02:00
```