Clarify Reshape_1 operator documentation (#3330)
* Clarify Reshape_1 operator documentation * Fix style issue * Fix reshape documentation after review
This commit is contained in:
1 parent
94c6aefbfe
commit
0671916cf4
1 file changed
+73
-4
@@ -9,14 +9,16 @@
|
||||
**Detailed description**:
|
||||
|
||||
*Reshape* layer takes two input tensors: the tensor to be resized and the output tensor shape. The values in the second tensor could be -1, 0 and any positive integer number. The two special values -1 and 0:
|
||||
* `0` means "copy the respective dimension of the input tensor" if `special_zero` is set to `true`; otherwise it is a normal dimension and is applicable to empty tensors.
|
||||
* `-1` means that this dimension is calculated to keep the overall elements count the same as in the input tensor. Not more than one `-1` can be used in a reshape operation.
|
||||
* `0` means "copy the respective dimension *(left aligned)* of the input tensor" if `special_zero` is set to `true`; otherwise it is a normal dimension and is applicable to empty tensors.
|
||||
* `-1` means that this dimension is calculated to keep the overall elements count the same as in the input tensor. Not more than one `-1` can be used in a reshape operation.
|
||||
|
||||
If `special_zero` is set to `true` index of `0` cannot be larger than the rank of the input tensor.
|
||||
|
||||
**Attributes**:
|
||||
|
||||
* *special_zero*
|
||||
|
||||
* **Description**: *special_zero* controls how zero values in `shape` are interpreted. If *special_zero* is `false`, then 0 is interpreted as-is which means that output shape will contain a zero dimension at the specified location. Input and output tensors are empty in this case. If *special_zero* is `true`, then all zeros in `shape` implies the copying of corresponding dimensions from `data.shape` into the output shape.
|
||||
* **Description**: *special_zero* controls how zero values in `shape` are interpreted. If *special_zero* is `false`, then 0 is interpreted as-is which means that output shape will contain a zero dimension at the specified location. Input and output tensors are empty in this case. If *special_zero* is `true`, then all zeros in `shape` implies the copying of corresponding dimensions from `data.shape` into the output shape *(left aligned)*.
|
||||
* **Range of values**: `false` or `true`
|
||||
* **Type**: boolean
|
||||
* **Default value**: None
|
||||
@@ -51,7 +53,7 @@
|
||||
<dim>0</dim>
|
||||
</port>
|
||||
<port id="1">
|
||||
<dim>2</dim> <!--The tensor contains 3 elements: 0, 4 -->
|
||||
<dim>2</dim> <!--The tensor contains 2 elements: 0, 4 -->
|
||||
</port>
|
||||
</input>
|
||||
<output>
|
||||
@@ -87,3 +89,70 @@
|
||||
</layer>
|
||||
```
|
||||
|
||||
```xml
|
||||
<layer ... type="Reshape" ...>
|
||||
<data special_zero="true"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>2</dim>
|
||||
<dim>2</dim>
|
||||
<dim>3</dim>
|
||||
</port>
|
||||
<port id="1">
|
||||
<dim>4</dim> <!--The tensor contains 4 elements: 0, 0, 1, -1 -->
|
||||
</port>
|
||||
</input>
|
||||
<output>
|
||||
<port id="2">
|
||||
<dim>2</dim>
|
||||
<dim>2</dim>
|
||||
<dim>1</dim>
|
||||
<dim>3</dim>
|
||||
</port>
|
||||
</output>
|
||||
</layer>
|
||||
```
|
||||
|
||||
```xml
|
||||
<layer ... type="Reshape" ...>
|
||||
<data special_zero="true"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>3</dim>
|
||||
<dim>1</dim>
|
||||
<dim>1</dim>
|
||||
</port>
|
||||
<port id="1">
|
||||
<dim>2</dim> <!--The tensor contains 2 elements: -1, 0 -->
|
||||
</port>
|
||||
</input>
|
||||
<output>
|
||||
<port id="2">
|
||||
<dim>3</dim>
|
||||
<dim>1</dim>
|
||||
</port>
|
||||
</output>
|
||||
</layer>
|
||||
```
|
||||
|
||||
```xml
|
||||
<layer ... type="Reshape" ...>
|
||||
<data special_zero="true"/>
|
||||
<input>
|
||||
<port id="0">
|
||||
<dim>3</dim>
|
||||
<dim>1</dim>
|
||||
<dim>1</dim>
|
||||
</port>
|
||||
<port id="1">
|
||||
<dim>2</dim> <!--The tensor contains 2 elements: 0, -1 -->
|
||||
</port>
|
||||
</input>
|
||||
<output>
|
||||
<port id="2">
|
||||
<dim>3</dim>
|
||||
<dim>1</dim>
|
||||
</port>
|
||||
</output>
|
||||
</layer>
|
||||
```
|
||||
Reference in new issue
Block a user