テンソルフロー::作戦::変換2D

#include <nn_ops.h>

4 次元inputfilterテンソルを指定して 2 次元畳み込みを計算します。

まとめ

形状[batch, in_height, in_width, in_channels]の入力テンソルと形状[filter_height, filter_width, in_channels, out_channels]のフィルター/カーネル テンソルを指定すると、この演算は次の処理を実行します。

  1. フィルター[filter_height * filter_width * in_channels, output_channels]の形状を持つ 2 次元行列に平坦化します。
  2. 入力テンソルからイメージ パッチを抽出して、形状[batch, out_height, out_width, filter_height * filter_width * in_channels]仮想テンソルを形成します。
  3. パッチごとに、フィルター行列と画像パッチ ベクトルを右乗算します。

詳細については、デフォルトの NHWC 形式、

output[b, i, j, k] =
    sum_{di, dj, q} input[b, strides[1] * i + di, strides[2] * j + dj, q] *
                    filter[di, dj, q, k]
を使用します。

strides[0] = strides[3] = 1でなければなりません。水平方向と頂点のストライドが同じである最も一般的なケースでは、 strides = [1, stride, stride, 1]

引数:

  • スコープ:スコープオブジェクト
  • 入力: 4 次元テンソル。ディメンションの順序はdata_formatの値に従って解釈されます。詳細については以下を参照してください。
  • filter: 形状の 4 次元テンソル[filter_height, filter_width, in_channels, out_channels]
  • strides: 長さ 4 の 1 次元テンソル。 inputの各次元のスライディング ウィンドウのストライド。ディメンションの順序はdata_formatの値によって決まります。詳細については以下を参照してください。
  • padding: 使用するパディング アルゴリズムのタイプ。

オプションの属性 ( Attrsを参照):

  • 明示的パディング: padding"EXPLICIT"の場合、明示的なパディング量のリスト。 i 番目の次元の場合、次元の前後に挿入されるパディングの量は、それぞれexplicit_paddings[2 * i]explicit_paddings[2 * i + 1]です。 padding "EXPLICIT"でない場合、 explicit_paddings空でなければなりません。
  • data_format: 入出力データのデータ形式を指定します。デフォルトの形式「NHWC」では、データは[バッチ、高さ、幅、チャネル]の順序で保存されます。あるいは、形式を「NCHW」、つまり [バッチ、チャネル、高さ、幅] のデータ保存順序にすることもできます。
  • dilations: 長さ 4 の 1 次元テンソル。 inputの各次元の膨張係数。 k > 1 に設定すると、その次元の各フィルター要素間に k-1 個のスキップされたセルが存在します。ディメンションの順序はdata_formatの値によって決まります。詳細については上記を参照してください。バッチ内の膨張と深さの寸法は 1 である必要があります。

戻り値:

  • Output : 4 次元テンソル。ディメンションの順序はdata_formatの値によって決まります。詳細については以下を参照してください。

コンストラクターとデストラクター

Conv2D (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input filter, const gtl::ArraySlice< int > & strides, StringPiece padding)
Conv2D (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input filter, const gtl::ArraySlice< int > & strides, StringPiece padding, const Conv2D::Attrs & attrs)

パブリック属性

operation
output

公共機能

node () const
::tensorflow::Node *
operator::tensorflow::Input () const
operator::tensorflow::Output () const

パブリック静的関数

DataFormat (StringPiece x)
Dilations (const gtl::ArraySlice< int > & x)
ExplicitPaddings (const gtl::ArraySlice< int > & x)
UseCudnnOnGpu (bool x)

構造体

tensorflow:: ops:: Conv2D:: Attrs

Conv2Dのオプションの属性セッター。

パブリック属性

手術

Operation operation

出力

::tensorflow::Output output

公共機能

変換2D

 Conv2D(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input filter,
  const gtl::ArraySlice< int > & strides,
  StringPiece padding
)

変換2D

 Conv2D(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input filter,
  const gtl::ArraySlice< int > & strides,
  StringPiece padding,
  const Conv2D::Attrs & attrs
)

ノード

::tensorflow::Node * node() const 

演算子::tensorflow::入力

 operator::tensorflow::Input() const 

演算子::tensorflow::出力

 operator::tensorflow::Output() const 

パブリック静的関数

データ形式

Attrs DataFormat(
  StringPiece x
)

拡張

Attrs Dilations(
  const gtl::ArraySlice< int > & x
)

明示的なパディング

Attrs ExplicitPaddings(
  const gtl::ArraySlice< int > & x
)

CudnnOnGPU を使用する

Attrs UseCudnnOnGpu(
  bool x
)