DepthToSpace - 1 vs 13#
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 → DepthToSpace13
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])
|
26
5
|
**Attributes**
|
27
6
|
* **blocksize** (required):
|
28
7
|
Blocks of [blocksize, blocksize] are moved.
|
29
|
-
* **mode**:
|
30
|
-
DCR (default) for depth-column-row order re-arrangement. Use CRD for
|
31
|
-
column-row-depth order.
|
32
8
|
**Inputs**
|
33
9
|
* **input** (heterogeneous) - **T**:
|
34
10
|
Input tensor of [N,C,H,W], where N is the batch axis, C is the
|
35
11
|
channel or depth, H is the height and W is the width.
|
36
12
|
**Outputs**
|
37
13
|
* **output** (heterogeneous) - **T**:
|
38
14
|
Output tensor of [N, C/(blocksize * blocksize), H * blocksize, W *
|
39
15
|
blocksize].
|
40
16
|
**Type Constraints**
|
41
17
|
* **T** in (
|
42
|
-
tensor(bfloat16),
|
43
18
|
tensor(bool),
|
44
19
|
tensor(complex128),
|
45
20
|
tensor(complex64),
|
46
21
|
tensor(double),
|
47
22
|
tensor(float),
|
48
23
|
tensor(float16),
|
49
24
|
tensor(int16),
|
50
25
|
tensor(int32),
|
51
26
|
tensor(int64),
|
52
27
|
tensor(int8),
|
53
28
|
tensor(string),
|
54
29
|
tensor(uint16),
|
55
30
|
tensor(uint32),
|
56
31
|
tensor(uint64),
|
57
32
|
tensor(uint8)
|
58
33
|
):
|
59
34
|
Constrain input and output types to all tensor types.
|