tensorflow :: ops :: BatchToSpaceND
#include <array_ops.h>
BatchToSpace untuk tensor ND tipe T.
Ringkasan
Operasi ini membentuk kembali dimensi "kumpulan" 0 menjadi M + 1
dimensi block_shape + [batch]
, block_shape + [batch]
blok ini kembali ke kisi yang ditentukan oleh dimensi spasial [1, ..., M]
, untuk mendapatkan hasil dengan peringkat yang sama dengan input. Dimensi spasial dari hasil antara ini kemudian secara opsional dipotong sesuai dengan crops
untuk menghasilkan keluaran. Ini adalah kebalikan dari SpaceToBatch. Lihat di bawah untuk deskripsi yang tepat.
Argumen:
- scope: Objek Scope
- input: ND dengan shape
input_shape = [batch] + spatial_shape + remaining_shape
, di mana spatial_shape memiliki dimensi M. - block_shape: 1-D dengan shape
[M]
, semua nilai harus> = 1. - crop: 2-D dengan bentuk
[M, 2]
, semua nilai harus> = 0.crops[i] = [crop_start, crop_end]
menentukan jumlah crop dari dimensi inputi + 1
, yang sesuai dengan dimensi spasiali
. Diperlukancrop_start[i] + crop_end[i] <= block_shape[i] * input_shape[i + 1]
.
Operasi ini sama dengan langkah-langkah berikut:
- Membentuk
reshaped
input
menjadi bentukreshaped
: [bentuk_blok [0], ..., bentuk_blok [M-1], bets / prod (bentuk_blok), bentuk_input [1], ..., bentuk_input [N-1]] - Permutasi dimensi dari bentuk
reshaped
untuk menghasilkanpermuted
bentuk [batch / prod (bentuk_blok), bentuk_input [1], bentuk_blok [0], ..., bentuk_input [M], bentuk_blok [M-1], bentuk_input [M + 1], ..., bentuk_input [N-1]] - Membentuk kembali
permuted
untuk memproduksireshaped_permuted
bentuk [batch / prod (block_shape), input_shape [1] * block_shape [0], ..., input_shape [M] * block_shape [M-1], input_shape [M + 1], .. ., bentuk_input [N-1]] - Pangkas awal dan akhir dimensi
[1, ..., M]
darireshaped_permuted
sesuai dengancrops
untuk menghasilkan output berupa: [batch / prod (block_shape), input_shape [1] * block_shape [0] - crop [0, 0] - tanaman [0,1], ..., bentuk_input [M] * bentuk_blok [M-1] - tanaman [M-1,0] - tanaman [M-1,1], bentuk_input [M + 1] , ..., bentuk_input [N-1]]
Beberapa contoh:
(1) Untuk input bentuk berikut [4, 1, 1, 1]
, block_shape = [2, 2]
, dan crops = [[0, 0], [0, 0]]
:
[[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
Tensor keluaran memiliki bentuk [1, 2, 2, 1]
dan nilai:
x = [[[[1], [2]], [[3], [4]]]]
(2) Untuk input bentuk berikut [4, 1, 1, 3]
, block_shape = [2, 2]
, dan crops = [[0, 0], [0, 0]]
:
[[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
Tensor keluaran memiliki bentuk [1, 2, 2, 3]
dan nilai:
x = [[[[1, 2, 3], [4, 5, 6]], [[7, 8, 9], [10, 11, 12]]]]
(3) Untuk input bentuk berikut [4, 2, 2, 1]
, block_shape = [2, 2]
, dan crops = [[0, 0], [0, 0]]
:
x = [[[[1], [3]], [[9], [11]]], [[[2], [4]], [[10], [12]]], [[[5], [7]], [[13], [15]]], [[[6], [8]], [[14], [16]]]]
Tensor keluaran memiliki bentuk [1, 4, 4, 1]
dan nilai:
x = [[[[1], [2], [3], [4]], [[5], [6], [7], [8]], [[9], [10], [11], [12]], [[13], [14], [15], [16]]]]
(4) Untuk input bentuk berikut [8, 1, 3, 1]
, block_shape = [2, 2]
, dan 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]]]]
Tensor keluaran memiliki bentuk [2, 2, 4, 1]
dan nilai:
x = [[[[1], [2], [3], [4]], [[5], [6], [7], [8]]], [[[9], [10], [11], [12]], [[13], [14], [15], [16]]]]
Pengembalian:
-
Output
: Tensor keluaran.
Pembangun dan Penghancur | |
---|---|
BatchToSpaceND (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input block_shape, :: tensorflow::Input crops) |
Atribut publik | |
---|---|
operation | |
output |
Fungsi publik | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Atribut publik
operasi
Operation operation
keluaran
::tensorflow::Output output
Fungsi publik
BatchToSpaceND
BatchToSpaceND( const ::tensorflow::Scope & scope, ::tensorflow::Input input, ::tensorflow::Input block_shape, ::tensorflow::Input crops )
simpul
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Keluaran
operator::tensorflow::Output() const