Tensorflow :: ops :: ExpandDims
#include <array_ops.h>
Fügt eine Dimension von 1 in die Form eines Tensors ein.
Zusammenfassung
Bei einem Tensor input
, fügt dieser Vorgang eine Dimension von 1 in der Dimension Index axis
des input
‚s Form. Die Dimension axis
beginnt bei Null ist ; Wenn Sie eine negative Zahl für die axis
angeben, axis
diese vom Ende rückwärts gezählt.
Diese Operation ist nützlich, wenn Sie einem einzelnen Element eine Stapeldimension hinzufügen möchten. Wenn Sie beispielsweise ein einzelnes Bild mit Form [height, width, channels]
, können Sie es mit expand_dims(image, 0)
einem Stapel von 1 Bild machen, wodurch die Form [1, height, width, channels]
.
Andere Beispiele:
# 't' is a tensor of shape [2] shape(expand_dims(t, 0)) ==> [1, 2] shape(expand_dims(t, 1)) ==> [2, 1] shape(expand_dims(t, -1)) ==> [2, 1]
# 't2' is a tensor of shape [2, 3, 5] shape(expand_dims(t2, 0)) ==> [1, 2, 3, 5] shape(expand_dims(t2, 2)) ==> [2, 3, 1, 5] shape(expand_dims(t2, 3)) ==> [2, 3, 5, 1]
Diese Operation erfordert Folgendes:
-1-input.dims() <= dim <= input.dims()
Diese Operation bezieht sich auf squeeze()
, wodurch Abmessungen der Größe 1 entfernt werden.
Argumente:
- scope: Ein Scope- Objekt
- Achse: 0-D (skalar). Gibt den Dimensionsindex an, bei dem die Form der
input
. Muss im Bereich[-rank(input) - 1, rank(input)]
.
Kehrt zurück:
-
Output
: Enthält dieselben Daten wie dieinput
, jedoch wurde der Form eine zusätzliche Dimension der Größe 1 hinzugefügt.
Konstruktoren und Destruktoren | |
---|---|
ExpandDims (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input axis) |
Ö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
ExpandDims
ExpandDims( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input axis )
Knoten
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const