tensoreflusso:: ops:: Profondità allo spazio
#include <array_ops.h>DepthToSpace per tensori di tipo T.
Riepilogo
Riorganizza i dati dalla profondità in blocchi di dati spaziali. Questa è la trasformazione inversa di SpaceToDepth. Più specificamente, questa operazione restituisce una copia del tensore di input in cui i valori dalla dimensione depth vengono spostati in blocchi spaziali alle dimensioni height e width . L'attributo block_size indica la dimensione del blocco di input e il modo in cui i dati vengono spostati.
- Blocchi di dati di dimensione
block_size * block_sizedalla profondità vengono riorganizzati in blocchi non sovrapposti di dimensioneblock_size x block_size - La larghezza del tensore di output è
input_depth * block_size, mentre l'altezza èinput_height * block_size. - Le coordinate Y, X all'interno di ciascun blocco dell'immagine di uscita sono determinate dalla componente di ordine elevato dell'indice del canale di ingresso.
- La profondità del tensore di input deve essere divisibile per
block_size * block_size.
L'attributo data_format specifica il layout dei tensori di input e output con le seguenti opzioni: "NHWC": [ batch, height, width, channels ] "NCHW": [ batch, channels, height, width ] "NCHW_VECT_C": qint8 [ batch, channels / 4, height, width, 4 ]
È utile considerare l'operazione come la trasformazione di un tensore 6-D. ad esempio, per data_format = NHWC, ogni elemento nel tensore di input può essere specificato tramite 6 coordinate, ordinate in base al significato decrescente del layout della memoria come: n,iY,iX,bY,bX,oC (dove n=indice batch, iX, iY significa X o coordinate Y all'interno dell'immagine di ingresso, bX, bY significa coordinate all'interno del blocco di uscita, oC significa canali di uscita). L'output sarebbe l'input trasposto nel seguente layout: n,iY,bY,iX,bX,oC
Questa operazione è utile per ridimensionare le attivazioni tra le convoluzioni (ma mantenendo tutti i dati), ad esempio invece del pooling. È utile anche per addestrare modelli puramente convoluzionali.
Ad esempio, dato un input di forma [1, 1, 1, 4] , data_format = "NHWC" e block_size = 2:
x = [[[[1, 2, 3, 4]]]]
This operation will output a tensor of shape
[1, 2, 2, 1]:
[[[[1], [2]], [[3], [4]]]]
Qui, l'input ha un batch di 1 e ogni elemento batch ha forma [1, 1, 4] , l'output corrispondente avrà 2x2 elementi e avrà una profondità di 1 canale (1 = 4 / (block_size * block_size) ). La forma dell'elemento di output è [2, 2, 1] .
Per un tensore di input con profondità maggiore, qui di forma [1, 1, 1, 12] , ad esempio
x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
Questa operazione, per blocchi di dimensione pari a 2, restituirà il seguente tensore di forma [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]]]]
l'operatore restituirà il seguente tensore di forma [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
produzione
::tensorflow::Output output
Funzioni pubbliche
Profondità allo spazio
DepthToSpace( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size )
Profondità allo spazio
DepthToSpace( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size, const DepthToSpace::Attrs & attrs )
nodo
::tensorflow::Node * node() const
operatore::tensorflow::Input
operator::tensorflow::Input() const
operatore::tensorflow::Output
operator::tensorflow::Output() const
Funzioni pubbliche statiche
Formato dati
Attrs DataFormat( StringPiece x )