컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
텐서플로우:: 작전:: 공간으로의 깊이
#include <array_ops.h>
T 유형의 텐서에 대한 DepthToSpace .
요약
데이터를 깊이에서 공간 데이터 블록으로 재배열합니다. 이는 SpaceToDepth의 역변환입니다. 보다 구체적으로, 이 작업은 depth
차원의 값이 공간 블록에서 height
및 width
차원으로 이동되는 입력 텐서의 복사본을 출력합니다. block_size
속성은 입력 블록 크기와 데이터 이동 방법을 나타냅니다.
- 깊이에서
block_size * block_size
크기의 데이터 청크는 block_size x block_size
크기의 겹치지 않는 블록으로 재배열됩니다. - 출력 텐서의 너비는
input_depth * block_size
이고 높이는 input_height * block_size
입니다. - 출력 이미지의 각 블록 내 Y, X 좌표는 입력 채널 인덱스의 상위 구성 요소에 의해 결정됩니다.
- 입력 텐서의 깊이는
block_size * block_size
로 나눌 수 있어야 합니다.
data_format
속성은 다음 옵션을 사용하여 입력 및 출력 텐서의 레이아웃을 지정합니다: "NHWC": [ batch, height, width, channels ]
"NCHW": [ batch, channels, height, width ]
"NCHW_VECT_C": qint8 [ batch, channels / 4, height, width, 4 ]
이 작업을 6차원 Tensor 변환으로 간주하는 것이 유용합니다. 예를 들어 data_format = NHWC의 경우 입력 텐서의 각 요소는 6개 좌표를 통해 지정할 수 있으며 메모리 레이아웃 중요도를 감소시키는 순서로 다음과 같이 정렬할 수 있습니다. n,iY,iX,bY,bX,oC(여기서 n=배치 인덱스, iX, iY는 X를 의미함) 또는 입력 이미지 내의 Y 좌표, bX, bY는 출력 블록 내의 좌표를 의미하고 oC는 출력 채널을 의미합니다. 출력은 다음 레이아웃으로 바뀐 입력입니다: n,iY,bY,iX,bX,oC
이 작업은 풀링 대신 컨볼루션 간의 활성화 크기를 조정하는 데 유용합니다(그러나 모든 데이터는 유지). 이는 순수 컨볼루션 모델을 훈련하는 데에도 유용합니다.
예를 들어 [1, 1, 1, 4]
형태의 입력이 주어지면 data_format = "NHWC" 및 block_size = 2입니다.
x = [[[[1, 2, 3, 4]]]]
This operation will output a tensor of shape [1, 2, 2, 1]
:
[[[[1], [2]],
[[3], [4]]]]
여기서 입력은 1개의 배치를 가지며 각 배치 요소는 [1, 1, 4]
모양을 가지며 해당 출력은 2x2 요소를 가지며 1 채널의 깊이를 갖습니다(1 = 4 / (block_size * block_size)
). 출력 요소 모양은 [2, 2, 1]
입니다.
더 큰 깊이를 가진 입력 텐서의 경우, 여기서는 [1, 1, 1, 12]
모양입니다. 예:
x = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]
블록 크기가 2인 경우 이 작업은 [1, 2, 2, 3]
모양의 다음 텐서를 반환합니다.
[[[[1, 2, 3], [4, 5, 6]],
[[7, 8, 9], [10, 11, 12]]]]
Similarly, for the following input of shape [1 2 2 4]
, and a block size of 2:
x = [[[[1, 2, 3, 4],
[5, 6, 7, 8]],
[[9, 10, 11, 12],
[13, 14, 15, 16]]]]
연산자는 [1 4 4 1]
모양의 다음 텐서를 반환합니다.
x = [[[ [1], [2], [5], [6]],
[ [3], [4], [7], [8]],
[ [9], [10], [13], [14]],
[ [11], [12], [15], [16]]]]
Arguments:
- scope: A Scope object
- block_size: The size of the spatial block, same as in Space2Depth.
Returns:
Public attributes
공공 기능
마디
::tensorflow::Node * node() const
operator::tensorflow::Input() const
연산자::텐서플로우::출력
operator::tensorflow::Output() const
공개 정적 함수
Attrs DataFormat(
StringPiece x
)
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-07-27(UTC)
[null,null,["최종 업데이트: 2025-07-27(UTC)"],[],[],null,["# tensorflow::ops::DepthToSpace Class Reference\n\ntensorflow::ops::DepthToSpace\n=============================\n\n`#include \u003carray_ops.h\u003e`\n\n[DepthToSpace](/versions/r2.2/api_docs/cc/class/tensorflow/ops/depth-to-space#classtensorflow_1_1ops_1_1_depth_to_space) for tensors of type T.\n\nSummary\n-------\n\nRearranges data from depth into blocks of spatial data. This is the reverse transformation of SpaceToDepth. More specifically, this op outputs a copy of the input tensor where values from the `depth` dimension are moved in spatial blocks to the `height` and `width` dimensions. The attr `block_size` indicates the input block size and how the data is moved.\n\n\n- Chunks of data of size `block_size * block_size` from depth are rearranged into non-overlapping blocks of size `block_size x block_size`\n- The width the output tensor is `input_depth * block_size`, whereas the height is `input_height * block_size`.\n- The Y, X coordinates within each block of the output image are determined by the high order component of the input channel index.\n- The depth of the input tensor must be divisible by `block_size * block_size`.\n\n\u003cbr /\u003e\n\nThe `data_format` attr specifies the layout of the input and output tensors with the following options: \"NHWC\": `[ batch, height, width, channels ]` \"NCHW\": `[ batch, channels, height, width ]` \"NCHW_VECT_C\": `qint8 [ batch, channels / 4, height, width, 4 ]`\n\nIt is useful to consider the operation as transforming a 6-D [Tensor](/versions/r2.2/api_docs/cc/class/tensorflow/tensor#classtensorflow_1_1_tensor). e.g. for data_format = NHWC, Each element in the input tensor can be specified via 6 coordinates, ordered by decreasing memory layout significance as: n,iY,iX,bY,bX,oC (where n=batch index, iX, iY means X or Y coordinates within the input image, bX, bY means coordinates within the output block, oC means output channels). The output would be the input transposed to the following layout: n,iY,bY,iX,bX,oC\n\nThis operation is useful for resizing the activations between convolutions (but keeping all data), e.g. instead of pooling. It is also useful for training purely convolutional models.\n\nFor example, given an input of shape `[1, 1, 1, 4]`, data_format = \"NHWC\" and block_size = 2:\n\n\n```text\nx = [[[[1, 2, 3, 4]]]]\n```\n\n\u003cbr /\u003e\n\n\n``````text\n \n This operation will output a tensor of shape `[1, 2, 2, 1]`:\n \n [[[[1], [2]],\n [[3], [4]]]]\n \n Here, the input has a batch of 1 and each batch element has shape `[1, 1, 4]`, the corresponding output will have 2x2 elements and will have a depth of 1 channel (1 = `4 / (block_size * block_size)`). The output element shape is `[2, 2, 1]`.\n For an input tensor with larger depth, here of shape `[1, 1, 1, 12]`, e.g.\n \n \n```text\nx = [[[[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]]]]\n```\n\n \n This operation, for block size of 2, will return the following tensor of shape `[1, 2, 2, 3]`\n \n \n```text\n [[[[1, 2, 3], [4, 5, 6]],\n [[7, 8, 9], [10, 11, 12]]]]\n```\n\n \n \n \n`````text\n \n Similarly, for the following input of shape `[1 2 2 4]`, and a block size of 2:\n \n x = [[[[1, 2, 3, 4],\n [5, 6, 7, 8]],\n [[9, 10, 11, 12],\n [13, 14, 15, 16]]]]\n \n the operator will return the following tensor of shape `[1 4 4 1]`:\n \n \n```text\nx = [[[ [1], [2], [5], [6]],\n [ [3], [4], [7], [8]],\n [ [9], [10], [13], [14]],\n [ [11], [12], [15], [16]]]]\n```\n\n \n \n \n````gdscript\n \n Arguments:\n \n- scope: A /versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope object\n\n \n- block_size: The size of the spatial block, same as in Space2Depth.\n\n \n\n Returns:\n \n- /versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output: The output tensor. \n\n \n\n \n\n\n \n### Constructors and Destructors\n\n\n \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1a2c9e364eeb7f160468ea1d96f6cfb8e6(const ::/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input, int64 block_size)\n \n\n \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1a8f6fcb6f032b7cf643f973e6ac13c27c(const ::/versions/r2.2/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope & scope, ::/versions/r2.2/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input input, int64 block_size, const /versions/r2.2/api_docs/cc/struct/tensorflow/ops/depth-to-space/attrs#structtensorflow_1_1ops_1_1_depth_to_space_1_1_attrs & attrs)\n \n\n \n\n\n \n\n\n \n### Public attributes\n\n\n \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1a957382b910309c5111ee14e1ab67e743\n \n\n \n\n /versions/r2.2/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation\n \n\n \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1af26b151763bb3a313233613cc17a77f0\n \n\n \n\n ::/versions/r2.2/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output\n \n\n \n\n\n \n\n\n \n### Public functions\n\n\n \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1a41b9c51a62fa577cdd60303f1e4121ab() const \n \n\n \n\n ::tensorflow::Node *\n \n\n \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1a0ef22b3a73050121df809b37a5bcf10c() const \n \n\n \n\n `\n` \n`\n` \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1a20278953425786797aa70c161f3c746b() const \n \n\n \n\n `\n` \n`\n` \n\n\n \n\n\n \n### Public static functions\n\n\n \n\n\n\n #classtensorflow_1_1ops_1_1_depth_to_space_1abc5ed947752840207dff9d8be78c49a3(StringPiece x)\n \n\n \n\n /versions/r2.2/api_docs/cc/struct/tensorflow/ops/depth-to-space/attrs#structtensorflow_1_1ops_1_1_depth_to_space_1_1_attrs\n \n\n \n\n\n \n\n\n \n### Structs\n\n\n \n\n\n\n /versions/r2.2/api_docs/cc/struct/tensorflow/ops/depth-to-space/attrs\n \n\n \nOptional attribute setters for /versions/r2.2/api_docs/cc/class/tensorflow/ops/depth-to-space#classtensorflow_1_1ops_1_1_depth_to_space. \n\n \n\n\n Public attributes\n \n \n### operation\n\n\n \n```\nOperation operation\n```\n\n \n\n \n \n \n### output\n\n\n \n\n\n```text\n::tensorflow::Output output\n```\n\n \n\n \n Public functions\n \n \n### DepthToSpace\n\n\n \n\n\n```gdscript\n DepthToSpace(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n int64 block_size\n)\n```\n\n \n\n \n \n \n### DepthToSpace\n\n\n \n\n\n```gdscript\n DepthToSpace(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input input,\n int64 block_size,\n const DepthToSpace::Attrs & attrs\n)\n```\n\n \n\n \n \n \n### node\n\n\n \n\n\n```gdscript\n::tensorflow::Node * node() const \n```\n\n \n\n \n \n \n### operator::tensorflow::Input\n\n\n \n\n\n```gdscript\n operator::tensorflow::Input() const \n```\n\n \n\n \n \n \n### operator::tensorflow::Output\n\n\n \n\n\n```gdscript\n operator::tensorflow::Output() const \n```\n\n \n\n \n Public static functions\n \n \n### DataFormat\n\n\n \n\n\n```text\nAttrs DataFormat(\n StringPiece x\n)\n```\n\n \n\n \n\n \n\n \n````\n`````\n``````"]]