tensorflow:: ops:: ScatterNdAdd
#include <state_ops.h>変数内の個々の値またはスライスに疎加算を適用します。
まとめ
refはランクPのTensorであり、 indicesはランクQのTensorです。
indices 、 refへのインデックスを含む整数テンソルでなければなりません。形状は[d_0, ..., d_{Q-2}, K]で0 < K <= Pでなければなりません。
indicesの最も内側の次元(長さK )は、 refのK番目の次元に沿った要素( K = P場合)またはスライス( K < Pの場合)へのインデックスに対応します。
updates 、形状が次のランクQ-1+PKのTensorです。
[d_0, ..., d_{Q-2}, ref.shape[K], ..., ref.shape[P-1]]
例えば、ランク1のテンソルに4つの散在要素を追加して、合計8つの要素を持つテンソルにしたいとします。Pythonでは、その追加は次のようになります。
ref = tf.Variable([1, 2, 3, 4, 5, 6, 7, 8]) indices = tf.constant([[4], [3], [1], [7]]) updates = tf.constant([9, 10, 11, 12]) add = tf.scatter_nd_add(ref, indices, updates) with tf.Session() as sess: print sess.run(add)
結果としてrefに反映される更新内容は以下のようになります。
[1, 13, 3, 14, 14, 6, 7, 20]
スライスを更新する方法の詳細については、 tf.scatter_nd参照してください。
議論:
- スコープ:スコープオブジェクト
- 参照: 可変テンソル。変数ノードから取得する必要があります。
- indices:テンソル。int32、int64 のいずれかの型である必要があります。ref へのインデックスのテンソル。
- 更新:テンソル。ref と同じ型である必要があります。ref に追加する更新された値のテンソル。
オプション属性( Attrs参照):
- use_locking: オプションのブール値。デフォルトはTrueです。Trueの場合、代入はロックによって保護されます。それ以外の場合は動作は未定義ですが、競合が少なくなる可能性があります。
返品:
-
Output:参照と同じ。更新後に更新された値を使用したい操作の便宜のために返されます。
コンストラクターとデストラクタ | |
|---|---|
ScatterNdAdd (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates) | |
ScatterNdAdd (const :: tensorflow::Scope & scope, :: tensorflow::Input ref, :: tensorflow::Input indices, :: tensorflow::Input updates, const ScatterNdAdd::Attrs & attrs) |
公開属性 | |
|---|---|
operation | |
output_ref | |
公的機能 | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
パブリック静的関数 | |
|---|---|
UseLocking (bool x) | |
構造 | |
|---|---|
| tensorflow:: ops:: ScatterNdAdd:: Attrs | ScatterNdAddのオプション属性セッター。 |
公開属性
手術
Operation operation
出力参照
::tensorflow::Output output_ref
公的機能
ScatterNdAdd
ScatterNdAdd( const ::tensorflow::Scope & scope, ::tensorflow::Input ref, ::tensorflow::Input indices, ::tensorflow::Input updates )
ScatterNdAdd
ScatterNdAdd( const ::tensorflow::Scope & scope, ::tensorflow::Input ref, ::tensorflow::Input indices, ::tensorflow::Input updates, const ScatterNdAdd::Attrs & attrs )
ノード
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
パブリック静的関数
ロックを使用する
Attrs UseLocking( bool x )