Tensorflow :: ops :: BatchToSpaceND
#include <array_ops.h>
BatchToSpace für ND-Tensoren vom Typ T.
Zusammenfassung
Diese Operation formt die "Stapel" -Dimension 0 in M + 1
Dimensionen der Form block_shape + [batch]
, verschachtelt diese Blöcke zurück in das durch die räumlichen Dimensionen [1, ..., M]
definierte Gitter, um ein Ergebnis mit dem zu erhalten gleicher Rang wie die Eingabe. Die räumlichen Abmessungen dieses Zwischenergebnisses werden dann optional entsprechend der crops
, um die Ausgabe zu erzeugen. Dies ist die Umkehrung von SpaceToBatch. Siehe unten für eine genaue Beschreibung.
Argumente:
- scope: Ein Scope- Objekt
- Eingabe: ND mit Form
input_shape = [batch] + spatial_shape + remaining_shape
Form, wobei räumliche Form M Dimensionen hat. - block_shape: 1-D mit Form
[M]
, alle Werte müssen> = 1 sein. - Kulturen: 2-D mit der Form
[M, 2]
, alle Werte müssen> = 0 sein.crops[i] = [crop_start, crop_end]
gibt die Menge an Crop aus der Eingabedimensioni + 1
, die der räumlichen Dimensioni
. Es ist erforderlich, dasscrop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]
.
Dieser Vorgang entspricht den folgenden Schritten:
-
input
in Formreshaped
: [Blockform [0], ..., Blockform [M-1], Batch / Prod (Blockform), Eingabeform [1], ..., Eingabeform [N-1]] - Permutieren Sie die Abmessungen von
reshaped
, um einepermuted
Form zu erzeugen [Stapel / Produkt (Blockform), Eingabeform [1], Blockform [0], ..., Eingabeform [M], Blockform [M-1], Eingabeform [M + 1], ..., input_shape [N-1]] - Umformung
permuted
, um einereshaped_permuted
Form zu erzeugen [Charge / Produkt (Blockform), Eingabeform [1] * Blockform [0], ..., Eingabeform [M] * Blockform [M-1], Eingabeform [M + 1], .. ., input_shape [N-1]] - Schneiden Sie den Anfang und das Ende der Dimensionen
[1, ..., M]
vonreshaped_permuted
entsprechend dencrops
zu, um die Ausgabe der Form zu erzeugen: [batch / prod (block_shape), input_shape [1] * block_shape [0] - crop [0, 0] - Pflanzen [0,1], ..., Eingabeform [M] * Blockform [M-1] - Pflanzen [M-1,0] - Pflanzen [M-1,1], Eingabeform [M + 1] , ..., input_shape [N-1]]
Einige Beispiele:
(1) Für die folgende Eingabe von Form [4, 1, 1, 1]
ist block_shape = [2, 2]
und block_shape = [2, 2]
crops = [[0, 0], [0, 0]]
:
[[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
Der Ausgangstensor hat Form [1, 2, 2, 1]
und Wert:
x = [[[[1], [2]], [[3], [4]]]]
(2) Für die folgende Eingabe von Form [4, 1, 1, 3]
ist block_shape = [2, 2]
und block_shape = [2, 2]
crops = [[0, 0], [0, 0]]
:
[[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
Der Ausgangstensor hat Form [1, 2, 2, 3]
und Wert:
x = [[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]]
(3) Für die folgende Eingabe der Form [4, 2, 2, 1]
gilt block_shape = [2, 2]
und block_shape = [2, 2]
crops = [[0, 0], [0, 0]]
:
x = [[[[1], [3]], [[9], [11]]], [[[2], [4]], [[10], [12]]], [[[5], [7]], [[13], [15]]], [[[6], [8]], [[14], [16]]]]
Der Ausgangstensor hat Form [1, 4, 4, 1]
und Wert:
x = [[[[1], [2], [3], [4]], [[5], [6], [7], [8]], [[9], [10], [11], [12]], [[13], [14], [15], [16]]]]
(4) Für die folgende Eingabe der Form [8, 1, 3, 1]
gilt block_shape = [2, 2]
und block_shape = [2, 2]
crops = [[0, 0], [2, 0]]
:
x = [[[[0], [1], [3]]], [[[0], [9], [11]]], [[[0], [2], [4]]], [[[0], [10], [12]]], [[[0], [5], [7]]], [[[0], [13], [15]]], [[[0], [6], [8]]], [[[0], [14], [16]]]]
Der Ausgangstensor hat Form [2, 2, 4, 1]
und Wert:
x = [[[[1], [2], [3], [4]], [[5], [6], [7], [8]]], [[[9], [10], [11], [12]], [[13], [14], [15], [16]]]]
Kehrt zurück:
-
Output
: Der Ausgangstensor.
Konstruktoren und Destruktoren | |
---|---|
BatchToSpaceND (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input block_shape, :: tensorflow::Input crops) |
Öffentliche Attribute | |
---|---|
operation | |
output |
Öffentliche Funktionen | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Öffentliche Attribute
Operation
Operation operation
Ausgabe
::tensorflow::Output output
Öffentliche Funktionen
BatchToSpaceND
BatchToSpaceND( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input block_shape, ::tensorflow::Input crops )
Knoten
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const