テンソルフロー::作戦:: 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]]

引数:

  • スコープ:スコープオブジェクト
  • インデックス: 1 次元テンソル。ランクはsegment_idsと同じです。
  • segment_ids: 1 次元テンソル。値は並べ替える必要があり、繰り返すことができます。
  • num_segments: 個別のセグメント ID の数と同じである必要があります。

戻り値:

  • Output : サイズがnum_segmentsである次元 0 を除き、データと同じ形状を持ちます。

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

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

 SparseSegmentSumWithNumSegments(
  const ::tensorflow::Scope & scope,
  ::tensorflow::Input data,
  ::tensorflow::Input indices,
  ::tensorflow::Input segment_ids,
  ::tensorflow::Input num_segments
)

ノード

::tensorflow::Node * node() const 

演算子::tensorflow::入力

 operator::tensorflow::Input() const 

演算子::tensorflow::出力

 operator::tensorflow::Output() const