Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::BatchToSpace
#include <array_ops.h>
BatchToSpace for 4-D tensors of type T.
Summary
This is a legacy version of the more general BatchToSpaceND.
Rearranges (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.
Arguments:
- scope: A Scope object
- 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
.
- 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: crops = [[crop_top, crop_bottom], [crop_left, crop_right]]
Returns:
Output
: 4-D with shape [batch, height, width, depth]
, where: height = height_pad - crop_top - crop_bottom
width = width_pad - crop_left - crop_right
The attr block_size
must be greater than one. It indicates the block size.
Some examples:
(1) For the following input of shape [4, 1, 1, 1]
and block_size of 2:
[[[[1]]], [[[2]]], [[[3]]], [[[4]]]]
The output tensor has shape [1, 2, 2, 1]
and value:
x = [[[[1], [2]], [[3], [4]]]]
(2) For the following input of shape [4, 1, 1, 3]
and block_size of 2:
[[[[1, 2, 3]]], [[[4, 5, 6]]], [[[7, 8, 9]]], [[[10, 11, 12]]]]
The output tensor has shape [1, 2, 2, 3]
and value:
x = [[[[1, 2, 3], [4, 5, 6]],
[[7, 8, 9], [10, 11, 12]]]]
(3) For the following input of shape [4, 2, 2, 1]
and block_size of 2:
x = [[[[1], [3]], [[9], [11]]],
[[[2], [4]], [[10], [12]]],
[[[5], [7]], [[13], [15]]],
[[[6], [8]], [[14], [16]]]]
The output tensor has shape [1, 4, 4, 1]
and value:
x = [[[[1], [2], [3], [4]],
[[5], [6], [7], [8]],
[[9], [10], [11], [12]],
[[13], [14], [15], [16]]]]
(4) For the following input of shape [8, 1, 2, 1]
and block_size of 2:
x = [[[[1], [3]]], [[[9], [11]]], [[[2], [4]]], [[[10], [12]]],
[[[5], [7]]], [[[13], [15]]], [[[6], [8]]], [[[14], [16]]]]
The output tensor has shape [2, 2, 4, 1]
and value:
x = [[[[1], [3]], [[5], [7]]],
[[[2], [4]], [[10], [12]]],
[[[5], [7]], [[13], [15]]],
[[[6], [8]], [[14], [16]]]]
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2020-04-20 UTC.
[null,null,["Last updated 2020-04-20 UTC."],[],[],null,["# tensorflow::ops::BatchToSpace Class Reference\n\ntensorflow::ops::BatchToSpace\n=============================\n\n`#include \u003carray_ops.h\u003e`\n\n[BatchToSpace](/versions/r1.15/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/r1.15/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/r1.15/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/r1.15/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/r1.15/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r1.15/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` input, ::`[tensorflow::Input](/versions/r1.15/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/r1.15/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_batch_to_space_1aacc62122ef498fc3a9ee89afdbcc6b74) | `::`[tensorflow::Output](/versions/r1.15/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```"]]