Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
tensoreflusso:: ops:: BatchToSpace
#include <array_ops.h>
BatchToSpace per tensori 4-D di tipo T.
Riepilogo
Questa è una versione legacy del più generale BatchToSpaceND .
Riorganizza (permuta) i dati dal batch in blocchi di dati spaziali, seguiti dal ritaglio. Questa è la trasformazione inversa di SpaceToBatch. Più specificamente, questa operazione restituisce una copia del tensore di input in cui i valori dalla dimensione batch
vengono spostati in blocchi spaziali alle dimensioni height
e width
, seguiti dal ritaglio lungo le dimensioni height
e width
.
Argomenti:
- scope: un oggetto Scope
- input: tensore 4-D con forma
[batch*block_size*block_size, height_pad/block_size, width_pad/block_size, depth]
. Si noti che la dimensione batch del tensore di input deve essere divisibile per block_size * block_size
. - crops: tensore 2-D di interi non negativi con forma
[2, 2]
. Specifica quanti elementi ritagliare dal risultato intermedio attraverso le dimensioni spaziali come segue: crops = [[crop_top, crop_bottom], [crop_left, crop_right]]
Resi:
-
Output
: 4-D con forma [batch, height, width, depth]
, dove: height = height_pad - crop_top - crop_bottom
width = width_pad - crop_left - crop_right
L'attributo block_size
deve essere maggiore di uno. Indica la dimensione del blocco.
Alcuni esempi:
(1) Per il seguente input di forma [4, 1, 1, 1]
e block_size pari a 2:
[[[[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]
e block_size pari a 2:
[[[[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]
e block_size pari a 2:
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, 2, 1]
e block_size pari a 2:
x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],
[[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]
Il tensore di uscita ha forma [2, 2, 4, 1]
e valore:
x = [[[[1], [3]], [[5], [7]]],
[[[2], [4]], [[10], [12]]],
[[[5], [7]], [[13], [15]]],
[[[6], [8]], [[14], [16]]]]
Attributi pubblici
Funzioni pubbliche
nodo
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operatore::tensorflow::Output
operator::tensorflow::Output() const
Salvo quando diversamente specificato, i contenuti di questa pagina sono concessi in base alla licenza Creative Commons Attribution 4.0, mentre gli esempi di codice sono concessi in base alla licenza Apache 2.0. Per ulteriori dettagli, consulta le norme del sito di Google Developers. Java è un marchio registrato di Oracle e/o delle sue consociate.
Ultimo aggiornamento 2025-07-26 UTC.
[null,null,["Ultimo aggiornamento 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```"]]