tensorflow:: ops:: SparseSegmentSumWithNumSegments
#include <math_ops.h>テンソルの疎なセグメントに沿った合計を計算します。
まとめ
SparseSegmentSumと同様ですが、 segment_idsにIDが欠落していても問題ありません。IDが欠落している場合、その位置のoutputテンソルはゼロになります。
セグメントの説明については、セグメンテーションに関するセクションをお読みください。
例えば:
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
tf.sparse_segment_sum_with_num_segments( c, tf.constant([0, 1]), tf.constant([0, 0]), num_segments=3) # => [[0 0 0 0] # [0 0 0 0] # [0 0 0 0]]
tf.sparse_segment_sum_with_num_segments(c, tf.constant([0, 1]), tf.constant([0, 2], num_segments=4)) # => [[ 1 2 3 4] # [ 0 0 0 0] # [-1 -2 -3 -4] # [ 0 0 0 0]]
議論:
- スコープ:スコープオブジェクト
- indices: 1次元テンソル。segment_ids
segment_ids同じランクを持ちます。 - segment_ids: 1次元テンソル。値はソートされている必要があり、重複しても構いません。
- num_segments: 異なるセグメントIDの数と等しくなければなりません。
返品:
-
Output: データと同じ形状ですが、次元0のサイズはnum_segmentsです。
コンストラクターとデストラクタ | |
|---|---|
SparseSegmentSumWithNumSegments (const :: tensorflow::Scope & scope, :: tensorflow::Input data, :: tensorflow::Input indices, :: tensorflow::Input segment_ids, :: tensorflow::Input num_segments) |
公開属性 | |
|---|---|
operation | |
output | |
公的機能 | |
|---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const | |
公開属性
手術
Operation operation
出力
::tensorflow::Output output
公的機能
スパースセグメント合計(セグメント数を含む)
SparseSegmentSumWithNumSegments( const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input indices, ::tensorflow::Input segment_ids, ::tensorflow::Input num_segments )
ノード
::tensorflow::Node * node() const
operator::tensorflow::Input
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const