tensorflow::ops::BatchToSpaceND

#include <array_ops.h>

T tipi ND tensörleri için BatchToSpace fonksiyonu .

Özet

Bu işlem, "parti" boyutu 0'ı, şekil block_shape + [batch] olan M + 1 boyutlu bir şekle dönüştürür, bu blokları [1, ..., M] uzamsal boyutlarıyla tanımlanan ızgaraya geri yerleştirir ve girişle aynı sıralamaya sahip bir sonuç elde eder. Bu ara sonucun uzamsal boyutları daha sonra isteğe bağlı olarak crops göre kırpılarak çıktı üretilir. Bu, SpaceToBatch işleminin tersidir. Ayrıntılı açıklama için aşağıya bakınız.

Argümanlar:

  • kapsam: Bir Kapsam nesnesi
  • Giriş: input_shape = [batch] + spatial_shape + remaining_shape şeklinde ND, burada spatial_shape M boyuta sahiptir.
  • block_shape: [M] şeklinde 1 boyutlu, tüm değerler 1'den büyük veya eşit olmalıdır.
  • crops: [M, 2] şeklinde 2 boyutlu, tüm değerler >= 0 olmalıdır crops[i] = [crop_start, crop_end] , i + 1 giriş boyutundan (uzamsal boyut i karşılık gelir) kırpılacak miktarı belirtir. crop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1] olması gereklidir.

Bu işlem aşağıdaki adımlara eşdeğerdir:

  1. Yeniden reshaped şekle input : [block_shape[0], ..., block_shape[M-1], batch / prod(block_shape), input_shape[1], ..., input_shape[N-1]]
  2. permuted reshaped boyutun permütasyonu, [batch / prod(block_shape),input_shape[1], block_shape[0], ..., input_shape[M], block_shape[M-1],input_shape[M+1], ..., input_shape[N-1]] şeklinde permütasyonlu bir yapı oluşturacak şekilde yapılır.
  3. [batch / prod(block_shape),input_shape[1] * block_shape[0], ..., input_shape[M] * block_shape[M-1],input_shape[M+1], ..., input_shape[N-1]] reshaped_permuted permuted üretmek için yeniden şekillendirildi.
  4. reshaped_permuted [1, ..., M] boyutlarının başlangıç ​​ve bitiş noktalarını crops göre kırparak şu şeklin çıktısını üretin: [batch / prod(block_shape),input_shape[1] * block_shape[0] - crops[0,0] - crops[0,1], ..., input_shape[M] * block_shape[M-1] - crops[M-1,0] - crops[M-1,1],input_shape[M+1], ..., input_shape[N-1]]

Bazı örnekler:

(1) [4, 1, 1, 1] şeklinde aşağıdaki girdi için, block_shape = [2, 2] ve crops = [[0, 0], [0, 0]] :

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

Çıktı tensörünün şekli [1, 2, 2, 1] ve değeri şöyledir:

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

(2) [4, 1, 1, 3] şeklindeki aşağıdaki girdi için, block_shape = [2, 2] ve crops = [[0, 0], [0, 0]] :

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

Çıktı tensörünün şekli [1, 2, 2, 3] ve değeri şöyledir:

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

(3) [4, 2, 2, 1] şeklinde aşağıdaki girdi için, block_shape = [2, 2] ve crops = [[0, 0], [0, 0]] :

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

Çıktı tensörünün şekli [1, 4, 4, 1] ve değeri şöyledir:

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

(4) [8, 1, 3, 1] şeklinde aşağıdaki girdi için, block_shape = [2, 2] ve 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]]]]

Çıktı tensörünün şekli [2, 2, 4, 1] ve değeri şöyledir:

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

İadeler:

  • Output : Çıktı tensörü.

Yapıcılar ve Yıkıcılar

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

Genel özellikler

operation
output

Kamusal işlevler

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

Genel özellikler

operasyon

Operation operation

çıktı

::tensorflow::Output output

Kamusal işlevler

BatchToSpaceND

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

düğüm

::tensorflow::Node * node() const 

operatör::tensorflow::Giriş

 operator::tensorflow::Input() const 

operatör::tensorflow::Çıktı

 operator::tensorflow::Output() const