Tensorflow :: ops :: DepthToSpace
#include <array_ops.h>
DepthToSpace für Tensoren vom Typ T.
Zusammenfassung
Ordnet Daten aus der Tiefe in Blöcke von Geodaten um. Dies ist die umgekehrte Transformation von SpaceToDepth. Insbesondere gibt diese Operation eine Kopie des Eingabetensors aus, bei der Werte aus der depth
in räumlichen Blöcken in die height
und width
verschoben werden. Die attr block_size
gibt die Größe des Eingabeblocks und die Art und Weise an, wie die Daten verschoben werden.
-
block_size * block_size
der Größeblock_size * block_size
aus der Tiefe werden in nicht überlappende Blöcke der Größeblock_size x block_size
- Die Breite des Ausgangstensors ist
input_depth * block_size
, während die Höheinput_height * block_size
. - Die Y-, X-Koordinaten in jedem Block des Ausgabebildes werden durch die Komponente höherer Ordnung des Eingangskanalindex bestimmt.
- Die Tiefe des Eingangstensors muss durch
block_size * block_size
teilbarblock_size * block_size
.
Das data_format
attr gibt das Layout der Eingabe- und Ausgabetensoren mit den folgenden Optionen an: "NHWC": [ batch, height, width, channels ]
"NCHW": [ batch, channels, height, width ]
"NCHW_VECT_C": qint8 [ batch, channels / 4, height, width, 4 ]
Es ist nützlich, die Operation als Transformation eines 6-D- Tensors zu betrachten . zB für data_format = NHWC kann jedes Element im Eingangstensor über 6 Koordinaten angegeben werden, die durch Verringern der Speicherlayoutbedeutung wie folgt geordnet sind: n, iY, iX, bY, bX, oC (wobei n = Stapelindex, iX, iY X bedeutet oder Y-Koordinaten innerhalb des Eingabebildes, bX, bY bedeutet Koordinaten innerhalb des Ausgabeblocks, oC bedeutet Ausgangskanäle). Die Ausgabe wäre die Eingabe, die in das folgende Layout transponiert ist: n, iY, bY, iX, bX, oC
Diese Operation ist nützlich, um die Größe der Aktivierungen zwischen den Windungen zu ändern (aber alle Daten beizubehalten), z. B. anstatt sie zu bündeln. Es ist auch nützlich, um rein Faltungsmodelle zu trainieren.
Beispiel: Bei einer Eingabe der Form [1, 1, 1, 4]
ist data_format = "NHWC" und block_size = 2:
x = [[[[1, 2, 3, 4]]]]
This operation will output a tensor of shape
[1, 2, 2, 1]
:
[[[[1], [2]], [[3], [4]]]]Hier hat der Eingang einen Stapel von 1 und jedes Stapelelement hat die Form
[1, 1, 4]
, der entsprechende Ausgang hat 2x2 Elemente und eine Tiefe von 1 Kanal (1 =4 / (block_size * block_size)
). Die Form des Ausgabeelements ist[2, 2, 1]
.Für einen Eingangstensor mit größerer Tiefe, hier mit der Form
[1, 1, 1, 12]
, z
x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]Diese Operation für eine Blockgröße von 2 gibt den folgenden Formtensor zurück
[1, 2, 2, 3]
[[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]]
Similarly, for the following input of shape
[1 2 2 4]
, and a block size of 2:
x = [[[[1, 2, 3, 4], [5, 6, 7, 8]], [[9, 10, 11, 12], [13, 14, 15, 16]]]]Der Bediener gibt den folgenden Formtensor zurück
[1 4 4 1]
:
x = [[[ [1], [2], [5], [6]], [ [3], [4], [7], [8]], [ [9], [10], [13], [14]], [ [11], [12], [15], [16]]]]
Arguments:
- scope: A Scope object
- block_size: The size of the spatial block, same as in Space2Depth.
Returns:
Output
: The output tensor.
Constructors and Destructors |
|
---|---|
DepthToSpace(const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size)
|
|
DepthToSpace(const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size, const DepthToSpace::Attrs & attrs)
|
Public attributes |
|
---|---|
operation
|
|
output
|
Public functions |
|
---|---|
node() const
|
::tensorflow::Node *
|
operator::tensorflow::Input() const
|
|
operator::tensorflow::Output() const
|
|
Public static functions |
|
---|---|
DataFormat(StringPiece x)
|
Structs |
|
---|---|
tensorflow:: |
Optional attribute setters for DepthToSpace. |
Public attributes
operation
Operation operation
Ausgabe
::tensorflow::Output output
Öffentliche Funktionen
DepthToSpace
DepthToSpace( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size )
DepthToSpace
DepthToSpace( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size, const DepthToSpace::Attrs & attrs )
Knoten
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const
Öffentliche statische Funktionen
Datei Format
Attrs DataFormat( StringPiece x )