tensorflow :: ops :: DepthToSpace
#include <array_ops.h>
タイプTのテンソルのDepthToSpace 。
概要
データを深さから空間データのブロックに再配置します。これはSpaceToDepthの逆変換です。より具体的には、この操作は、 depth
次元からの値が空間ブロックでheight
とwidth
次元に移動depth
れる入力テンソルのコピーを出力します。 attr block_size
は、入力ブロックサイズとデータの移動方法を示します。
- 深さからのサイズ
block_size * 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
attrは、次のオプションで入力テンソルと出力テンソルのレイアウトを指定します。 "NHWC": [ batch, height, width, channels ]
"NCHW": [ batch, channels, height, width ]
"NCHW_VECT_C": qint8 [ batch, channels / 4, height, width, 4 ]
この操作を6-Dテンソルの変換と見なすと便利です。たとえば、data_format = NHWCの場合、入力テンソルの各要素は6つの座標で指定でき、メモリレイアウトの重要度を次のように降順に並べます。または入力画像内のY座標、bX、bYは出力ブロック内の座標を意味し、oCは出力チャネルを意味します)。出力は、次のレイアウトに置き換えられた入力になります:n、iY、bY、iX、bX、oC
この操作は、たとえばプーリングの代わりに、畳み込み間のアクティベーションのサイズを変更する(ただし、すべてのデータを保持する)場合に役立ちます。また、純粋な畳み込みモデルのトレーニングにも役立ちます。
たとえば、形状[1, 1, 1, 4]
1、1、1、4 [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]
4 / (block_size * block_size)
[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, 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
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const
パブリック静的関数
DataFormat
Attrs DataFormat( StringPiece x )