テンソルフロー::作戦::マトリックスバンドパート

#include <array_ops.h>

最も内側の各行列の中心バンドの外側のすべてを設定するテンソルをコピーします。

まとめ

ゼロに。

band部分は次のように計算されます。 input k次元[I, J, K, ..., M, N]があると仮定すると、出力は同じ形状のテンソルになります。

band[i, j, k, ..., m, n] = in_band(m, n) * input[i, j, k, ..., m, n]

インジケーター機能

in_band(m, n) = (num_lower < 0 || (mn) <= num_lower)) && (num_upper < 0 || (nm) <= num_upper)

例えば:

# if 'input' is [[ 0,  1,  2, 3]
                 [-1,  0,  1, 2]
                 [-2, -1,  0, 1]
                 [-3, -2, -1, 0]],

tf.matrix_band_part(input, 1, -1) ==> [[ 0,  1,  2, 3]
                                       [-1,  0,  1, 2]
                                       [ 0, -1,  0, 1]
                                       [ 0,  0, -1, 0]],

tf.matrix_band_part(input, 2, 1) ==> [[ 0,  1,  0, 0]
                                      [-1,  0,  1, 0]
                                      [-2, -1,  0, 1]
                                      [ 0, -2, -1, 0]]

役立つ特殊なケース:

 tf.matrix_band_part(input, 0, -1) ==> Upper triangular part.
 tf.matrix_band_part(input, -1, 0) ==> Lower triangular part.
 tf.matrix_band_part(input, 0, 0) ==> Diagonal.

引数:

  • スコープ:スコープオブジェクト
  • 入力: ランクkテンソル。
  • num_ lower: 0 次元テンソル。保持する下対角線の数。負の場合は、下三角全体を保持します。
  • num_upper: 0 次元テンソル。保持する上対角線の数。負の場合は、上三角全体を保持します。

戻り値:

  • Output : 入力と同じ形状のランクkテンソル。抽出された縞状テンソル。

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

MatrixBandPart (const :: tensorflow::Scope & scope, :: tensorflow::Input input, :: tensorflow::Input num_lower, :: tensorflow::Input num_upper)

パブリック属性

band
operation

公共機能

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

パブリック属性

バンド

::tensorflow::Output band

手術

Operation operation

公共機能

マトリックスバンドパート

 MatrixBandPart(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input input,
  ::tensorflow::Input num_lower,
  ::tensorflow::Input num_upper
)

ノード

::tensorflow::Node * node() const 

演算子::tensorflow::入力

 operator::tensorflow::Input() const 

演算子::tensorflow::出力

 operator::tensorflow::Output() const