DepthToSpace - 1 vs 11¶
Next section compares an older to a newer version of the same operator after both definition are converted into markdown text. Green means an addition to the newer version, red means a deletion. Anything else is unchanged.
DepthToSpace1 → DepthToSpace11
RENAMED
@@ -1 +1 @@
|
|
1
1
|
DepthToSpace rearranges (permutes) data from depth into blocks of spatial data.
|
2
2
|
This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of
|
3
3
|
the input tensor where values from the depth dimension are moved in spatial blocks to the height
|
4
|
-
and width dimensions.
|
4
|
+
and width dimensions. By default, mode = DCR.
|
5
|
+
In the DCR mode, elements along the depth dimension from the input tensor are rearranged in the
|
6
|
+
following order: depth, column, and then row. The output y is computed from the input x as below:
|
7
|
+
|
8
|
+
b, c, h, w = x.shape
|
9
|
+
|
10
|
+
tmp = np.reshape(x, [b, blocksize, blocksize, c // (blocksize**2), h, w])
|
11
|
+
|
12
|
+
tmp = np.transpose(tmp, [0, 3, 4, 1, 5, 2])
|
13
|
+
|
14
|
+
y = np.reshape(tmp, [b, c // (blocksize**2), h * blocksize, w * blocksize])
|
15
|
+
|
16
|
+
In the CRD mode, elements along the depth dimension from the input tensor are rearranged in the
|
17
|
+
following order: column, row, and the depth. The output y is computed from the input x as below:
|
18
|
+
|
19
|
+
b, c, h, w = x.shape
|
20
|
+
|
21
|
+
tmp = np.reshape(x, [b, c // (blocksize ** 2), blocksize, blocksize, h, w])
|
22
|
+
|
23
|
+
tmp = np.transpose(tmp, [0, 1, 4, 2, 5, 3])
|
24
|
+
|
25
|
+
y = np.reshape(tmp, [b, c // (blocksize ** 2), h * blocksize, w * blocksize])
|
5
26
|
### Attributes
|
6
27
|
* **blocksize - INT** (required) :
|
7
28
|
Blocks of [blocksize, blocksize] are moved.
|
29
|
+
|
30
|
+
* **mode - STRING** (default is 'DCR'):
|
31
|
+
|
32
|
+
DCR (default) for depth-column-row order re-arrangement. Use CRD for column-row-depth order.
|
8
33
|
### Inputs
|
9
34
|
- **input** (heterogeneous) - **T**:
|
10
35
|
Input tensor of [N,C,H,W], where N is the batch axis, C is the channel or depth, H is the height and W is the width.
|
11
36
|
### Outputs
|
12
37
|
- **output** (heterogeneous) - **T**:
|
13
38
|
Output tensor of [N, C/(blocksize * blocksize), H * blocksize, W * blocksize].
|
14
39
|
### Type Constraints
|
15
40
|
* **T** in ( tensor(bool), tensor(complex128), tensor(complex64), tensor(double), tensor(float), tensor(float16), tensor(int16), tensor(int32), tensor(int64), tensor(int8), tensor(string), tensor(uint16), tensor(uint32), tensor(uint64), tensor(uint8) ):
|
16
41
|
Constrain input and output types to all tensor types.
|