텐서플로우:: 작전:: 공간으로의 깊이

#include <array_ops.h>

T 유형의 텐서에 대한 DepthToSpace .

요약

데이터를 깊이에서 공간 데이터 블록으로 재배열합니다. 이는 SpaceToDepth의 역변환입니다. 보다 구체적으로, 이 작업은 depth 차원의 값이 공간 블록에서 heightwidth 차원으로 이동되는 입력 텐서의 복사본을 출력합니다. 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:

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::ops::DepthToSpace::Attrs

Optional attribute setters for DepthToSpace.

Public attributes

operation

Operation operation

산출

::tensorflow::Output output

공공 기능

공간으로의 깊이

 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
)

마디

::tensorflow::Node * node() const 

연산자::텐서플로우::입력

 operator::tensorflow::Input() const 

연산자::텐서플로우::출력

 operator::tensorflow::Output() const 

공개 정적 함수

데이터형식

Attrs DataFormat(
  StringPiece x
)