tensoreflusso:: ops:: BatchToSpaceND

#include <array_ops.h>

BatchToSpace per tensori ND di tipo T.

Riepilogo

Questa operazione rimodella la dimensione "batch" 0 in M + 1 dimensioni di forma block_shape + [batch] , intercala nuovamente questi blocchi nella griglia definita dalle dimensioni spaziali [1, ..., M] , per ottenere un risultato con il stesso rango dell'input. Le dimensioni spaziali di questo risultato intermedio vengono quindi facoltativamente ritagliate in base alle crops per produrre l'output. Questo è il contrario di SpaceToBatch. Vedi sotto per una descrizione precisa.

Argomenti:

  • scope: un oggetto Scope
  • input: ND con forma input_shape = [batch] + spatial_shape + remaining_shape , dove forma_spaziale ha M dimensioni.
  • block_shape: 1-D con forma [M] , tutti i valori devono essere >= 1.
  • crops: 2-D con forma [M, 2] , tutti i valori devono essere >= 0. crops[i] = [crop_start, crop_end] specifica la quantità da ritagliare dalla dimensione di input i + 1 , che corrisponde alla dimensione spaziale i . È necessario che crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1] .

Questa operazione equivale ai seguenti passaggi:

  1. Riforma input per reshaped la forma: [block_shape[0], ..., block_shape[M-1], batch / prod(block_shape), input_shape[1], ..., input_shape[N-1]]
  2. Permuta le dimensioni di reshaped per produrre permuted di forma [batch / prod(block_shape),input_shape[1], block_shape[0], ..., input_shape[M], block_shape[M-1],input_shape[M+1], ..., forma_input[N-1]]
  3. Riforma permuted per produrre reshaped_permuted di forma [batch / prod(block_shape),input_shape[1] * block_shape[0], ..., input_shape[M] * block_shape[M-1],input_shape[M+1], .. ., forma_input[N-1]]
  4. Ritaglia l'inizio e la fine delle dimensioni [1, ..., M] di reshaped_permuted in base alle crops per produrre l'output di forma: [batch / prod(block_shape),input_shape[1] * block_shape[0] - crops[0, 0] - ritaglia[0,1], ..., input_shape[M] * block_shape[M-1] - ritaglia[M-1,0] - crops[M-1,1],input_shape[M+1] , ..., forma_input[N-1]]

Qualche esempio:

(1) Per il seguente input di forma [4, 1, 1, 1] , block_shape = [2, 2] e crops = [[0, 0], [0, 0]] :

[[[[1]]], [[[2]]], [[[3]]], [[[4]]]]

Il tensore di uscita ha forma [1, 2, 2, 1] e valore:

x = [[[[1], [2]], [[3], [4]]]]

(2) Per il seguente input di forma [4, 1, 1, 3] , block_shape = [2, 2] e crops = [[0, 0], [0, 0]] :

[[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]

Il tensore di uscita ha forma [1, 2, 2, 3] e valore:

x = [[[[1, 2, 3], [4, 5, 6]],
      [[7, 8, 9], [10, 11, 12]]]]

(3) Per il seguente input di forma [4, 2, 2, 1] , block_shape = [2, 2] e crops = [[0, 0], [0, 0]] :

x = [[[[1], [3]], [[9], [11]]],
     [[[2], [4]], [[10], [12]]],
     [[[5], [7]], [[13], [15]]],
     [[[6], [8]], [[14], [16]]]]

Il tensore di uscita ha forma [1, 4, 4, 1] e valore:

x = [[[[1],   [2],  [3],  [4]],
     [[5],   [6],  [7],  [8]],
     [[9],  [10], [11],  [12]],
     [[13], [14], [15],  [16]]]]

(4) Per il seguente input di forma [8, 1, 3, 1] , block_shape = [2, 2] e 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]]]]

Il tensore di uscita ha forma [2, 2, 4, 1] e valore:

x = [[[[1],   [2],  [3],  [4]],
      [[5],   [6],  [7],  [8]]],
     [[[9],  [10], [11],  [12]],
      [[13], [14], [15],  [16]]]]

Ritorna:

  • Output : il tensore di uscita.

Costruttori e distruttori

BatchToSpaceND (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input block_shape, :: tensorflow::Input crops)

Attributi pubblici

operation
output

Funzioni pubbliche

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

Attributi pubblici

operazione

Operation operation

produzione

::tensorflow::Output output

Funzioni pubbliche

BatchToSpaceND

 BatchToSpaceND(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input block_shape,
  ::tensorflow::Input crops
)

nodo

::tensorflow::Node * node() const 

operatore::tensorflow::Input

 operator::tensorflow::Input() const 

operatore::tensorflow::Output

 operator::tensorflow::Output() const