Tetap teratur dengan koleksi
Simpan dan kategorikan konten berdasarkan preferensi Anda.
aliran tensor:: operasi:: BatchToSpace
#include <array_ops.h>
BatchToSpace untuk tensor 4-D tipe T.
Ringkasan
Ini adalah versi lawas dari BatchToSpaceND yang lebih umum.
Menyusun ulang (mengubah) data dari kumpulan menjadi blok data spasial, diikuti dengan pemotongan. Ini adalah transformasi kebalikan dari SpaceToBatch. Lebih khusus lagi, operasi ini menghasilkan salinan tensor masukan di mana nilai dari dimensi batch
dipindahkan dalam blok spasial ke dimensi height
dan width
, diikuti dengan pemotongan sepanjang dimensi height
dan width
.
Argumen:
- ruang lingkup: Objek Lingkup
- masukan: tensor 4-D dengan bentuk
[batch*block_size*block_size, height_pad/block_size, width_pad/block_size, depth]
. Perhatikan bahwa ukuran kumpulan tensor masukan harus habis dibagi block_size * block_size
. - tanaman: tensor 2-D bilangan bulat non-negatif dengan bentuk
[2, 2]
. Ini menentukan berapa banyak elemen yang akan dipotong dari hasil antara di seluruh dimensi spasial sebagai berikut: crops = [[crop_top, crop_bottom], [crop_left, crop_right]]
Pengembalian:
-
Output
: 4-D dengan bentuk [batch, height, width, depth]
, dimana: height = height_pad - crop_top - crop_bottom
width = width_pad - crop_left - crop_right
block_size
attr harus lebih besar dari satu. Ini menunjukkan ukuran blok.
Beberapa contoh:
(1) Untuk input bentuk [4, 1, 1, 1]
dan ukuran_blok 2 berikut:
[[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
Tensor keluaran memiliki bentuk [1, 2, 2, 1]
dan nilai:
x = [[[[1], [2]], [[3], [4]]]]
(2) Untuk input bentuk [4, 1, 1, 3]
dan ukuran_blok 2 berikut:
[[[[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 [4, 2, 2, 1]
dan ukuran_blok 2 berikut:
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 [8, 1, 2, 1]
dan ukuran_blok 2 berikut:
x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],
[[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]
Tensor keluaran memiliki bentuk [2, 2, 4, 1]
dan nilai:
x = [[[[1], [3]], [[5], [7]]],
[[[2], [4]], [[10], [12]]],
[[[5], [7]], [[13], [15]]],
[[[6], [8]], [[14], [16]]]]
Atribut publik
Fungsi publik
simpul
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Keluaran
operator::tensorflow::Output() const
Kecuali dinyatakan lain, konten di halaman ini dilisensikan berdasarkan Lisensi Creative Commons Attribution 4.0, sedangkan contoh kode dilisensikan berdasarkan Lisensi Apache 2.0. Untuk mengetahui informasi selengkapnya, lihat Kebijakan Situs Google Developers. Java adalah merek dagang terdaftar dari Oracle dan/atau afiliasinya.
Terakhir diperbarui pada 2025-07-26 UTC.
[null,null,["Terakhir diperbarui pada 2025-07-26 UTC."],[],[],null,["# tensorflow::ops::BatchToSpace Class Reference\n\ntensorflow::ops::BatchToSpace\n=============================\n\n`#include \u003carray_ops.h\u003e`\n\n[BatchToSpace](/versions/r2.1/api_docs/cc/class/tensorflow/ops/batch-to-space#classtensorflow_1_1ops_1_1_batch_to_space) for 4-D tensors of type T.\n\nSummary\n-------\n\nThis is a legacy version of the more general [BatchToSpaceND](/versions/r2.1/api_docs/cc/class/tensorflow/ops/batch-to-space-n-d#classtensorflow_1_1ops_1_1_batch_to_space_n_d).\n\nRearranges (permutes) data from batch into blocks of spatial data, followed by cropping. This is the reverse transformation of SpaceToBatch. More specifically, this op outputs a copy of the input tensor where values from the `batch` dimension are moved in spatial blocks to the `height` and `width` dimensions, followed by cropping along the `height` and `width` dimensions.\n\nArguments:\n\n- scope: A [Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- input: 4-D tensor with shape `[batch*block_size*block_size, height_pad/block_size, width_pad/block_size, depth]`. Note that the batch size of the input tensor must be divisible by `block_size * block_size`.\n- crops: 2-D tensor of non-negative integers with shape `[2, 2]`. It specifies how many elements to crop from the intermediate result across the spatial dimensions as follows: \n\n ```scdoc\n crops = [[crop_top, crop_bottom], [crop_left, crop_right]]\n ```\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): 4-D with shape `[batch, height, width, depth]`, where: \n\n ```scdoc\n height = height_pad - crop_top - crop_bottom\n width = width_pad - crop_left - crop_right\n ```\n\n\u003cbr /\u003e\n\nThe attr `block_size` must be greater than one. It indicates the block size.\n\nSome examples:\n\n(1) For the following input of shape `[4, 1, 1, 1]` and block_size of 2:\n\n\n```text\n[[[[1]]], [[[2]]], [[[3]]], [[[4]]]]\n```\n\n\u003cbr /\u003e\n\nThe output tensor has shape `[1, 2, 2, 1]` and value:\n\n\n```text\nx = [[[[1], [2]], [[3], [4]]]]\n```\n\n\u003cbr /\u003e\n\n(2) For the following input of shape `[4, 1, 1, 3]` and block_size of 2:\n\n\n```text\n[[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]\n```\n\n\u003cbr /\u003e\n\nThe output tensor has shape `[1, 2, 2, 3]` and value:\n\n\n```text\nx = [[[[1, 2, 3], [4, 5, 6]],\n [[7, 8, 9], [10, 11, 12]]]]\n```\n\n\u003cbr /\u003e\n\n(3) For the following input of shape `[4, 2, 2, 1]` and block_size of 2:\n\n\n```text\nx = [[[[1], [3]], [[9], [11]]],\n [[[2], [4]], [[10], [12]]],\n [[[5], [7]], [[13], [15]]],\n [[[6], [8]], [[14], [16]]]]\n```\n\n\u003cbr /\u003e\n\nThe output tensor has shape `[1, 4, 4, 1]` and value:\n\n\n```text\nx = [[[[1], [2], [3], [4]],\n [[5], [6], [7], [8]],\n [[9], [10], [11], [12]],\n [[13], [14], [15], [16]]]]\n```\n\n\u003cbr /\u003e\n\n(4) For the following input of shape `[8, 1, 2, 1]` and block_size of 2:\n\n\n```text\nx = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],\n [[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]\n```\n\n\u003cbr /\u003e\n\nThe output tensor has shape `[2, 2, 4, 1]` and value:\n\n\n```text\nx = [[[[1], [3]], [[5], [7]]],\n [[[2], [4]], [[10], [12]]],\n [[[5], [7]], [[13], [15]]],\n [[[6], [8]], [[14], [16]]]]\n```\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [BatchToSpace](#classtensorflow_1_1ops_1_1_batch_to_space_1a813bf5c031d4af21a394ba903c8dd8e7)`(const ::`[tensorflow::Scope](/versions/r2.1/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r2.1/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` crops, int64 block_size)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_batch_to_space_1a4f9b292d9339c4c44142a6dcec013410) | [Operation](/versions/r2.1/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_batch_to_space_1aacc62122ef498fc3a9ee89afdbcc6b74) | `::`[tensorflow::Output](/versions/r2.1/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_batch_to_space_1a54c1c787b320c2f52099bc7bc02a85ed)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_batch_to_space_1a23f9170b61d8e17feb37f1615a383de2)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_batch_to_space_1a6e84c3b9b55d05ad30e6bcf376278c1d)`() const ` | ` ` ` ` |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### BatchToSpace\n\n```gdscript\n BatchToSpace(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n ::tensorflow::Input crops,\n int64 block_size\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n```"]]