tensorflow :: ops :: DepthToSpace
#include <array_ops.h>
유형 T의 텐서에 대한 DepthToSpace .
요약
데이터를 깊이에서 공간 데이터 블록으로 다시 정렬합니다. 이것은 SpaceToDepth의 역변환입니다. 보다 구체적으로,이 연산은 depth
차원의 값이 공간 블록에서 height
및 width
차원으로 이동되는 입력 텐서의 복사본을 출력합니다. attr block_size
는 입력 블록 크기와 데이터 이동 방법을 나타냅니다.
- 깊이에서
block_size * block_size
크기의 데이터 청크는block_size x block_size
크기의 겹치지 않는 블록으로 재 배열됩니다. - 출력 텐서의 너비는
input_depth * block_size
input_height * 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 ]
작업을 6D Tensor 변환으로 고려하는 것이 유용합니다. 예를 들어 data_format = NHWC의 경우 입력 텐서의 각 요소는 6 개의 좌표를 통해 지정 될 수 있으며, 메모리 레이아웃 중요성을 감소시켜 다음과 같이 정렬 할 수 있습니다. 또는 입력 이미지 내의 Y 좌표, bX, bY는 출력 블록 내의 좌표를 의미하고, oC는 출력 채널을 의미). 출력은 다음 레이아웃으로 전치 된 입력입니다. n, iY, bY, iX, bX, oC
이 작업은 풀링 대신 컨볼 루션 간의 활성화 크기를 조정하는 데 유용합니다 (그러나 모든 데이터 유지). 순수 컨볼 루션 모델을 훈련하는데도 유용합니다.
예를 들어, shape [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, 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:
Output
: The output tensor.
Constructors and Destructors |
|
---|---|
DepthToSpace(const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size)
|
|
DepthToSpace(const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size, const DepthToSpace::Attrs & attrs)
|
Public attributes |
|
---|---|
operation
|
|
output
|
Public functions |
|
---|---|
node() const
|
::tensorflow::Node *
|
operator::tensorflow::Input() const
|
|
operator::tensorflow::Output() const
|
|
Public static functions |
|
---|---|
DataFormat(StringPiece x)
|
Structs |
|
---|---|
tensorflow:: |
Optional attribute setters for DepthToSpace. |
Public attributes
operation
Operation operation
산출
::tensorflow::Output output
공공 기능
DepthToSpace
DepthToSpace( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size )
DepthToSpace
DepthToSpace( const ::tensorflow::Scope & scope, ::tensorflow::Input input, int64 block_size, const DepthToSpace::Attrs & attrs )
마디
::tensorflow::Node * node() const
연산자 :: tensorflow :: 입력
operator::tensorflow::Input() const
연산자 :: tensorflow :: 출력
operator::tensorflow::Output() const
공개 정적 함수
DataFormat
Attrs DataFormat( StringPiece x )