tensorflow:: 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

 operator::tensorflow::Input() const 

operator::tensorflow::Output

 operator::tensorflow::Output() const 

パブリック静的関数

データフォーマット

Attrs DataFormat(
  StringPiece x
)