텐서플로우:: ops:: DepthToSpace

#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차원 텐서 변환으로 생각하면 이해하기 쉽습니다. 예를 들어 data_format이 NHWC인 경우, 입력 텐서의 각 요소는 메모리 레이아웃 중요도가 높은 순서대로 n, iY, iX, bY, bX, oC와 같은 6개의 좌표로 지정할 수 있습니다. (여기서 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
)