Tensorflow :: ops :: SparseSegmentSumWithNumSegments
#include <math_ops.h>
Berechnet die Summe entlang spärlicher Segmente eines Tensors.
Zusammenfassung
Wie SparseSegmentSum
, erlaubt jedoch fehlende IDs in segment_ids
. Wenn eine ID falsch ist, wird der output
an dieser Position auf Null gesetzt.
Lesen Sie den Abschnitt zur Segmentierung, um eine Erläuterung der Segmente zu erhalten.
Zum Beispiel:
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]]
Argumente:
- scope: Ein Scope- Objekt
- Indizes: Ein 1-D-Tensor. Hat den gleichen Rang wie
segment_ids
. - segment_ids: Ein 1-D-Tensor. Die Werte sollten sortiert sein und können wiederholt werden.
- num_segments: Sollte der Anzahl der unterschiedlichen Segment-IDs entsprechen.
Kehrt zurück:
-
Output
: Hat dieselbe Form wie Daten, mit Ausnahme der Dimension 0 mit der Größenum_segments
.
Konstruktoren und Destruktoren | |
---|---|
SparseSegmentSumWithNumSegments (const :: tensorflow::Scope & scope, :: tensorflow::Input data, :: tensorflow::Input indices, :: tensorflow::Input segment_ids, :: tensorflow::Input num_segments) |
Öffentliche Attribute | |
---|---|
operation | |
output |
Öffentliche Funktionen | |
---|---|
node () const | ::tensorflow::Node * |
operator::tensorflow::Input () const | |
operator::tensorflow::Output () const |
Öffentliche Attribute
Operation
Operation operation
Ausgabe
::tensorflow::Output output
Öffentliche Funktionen
SparseSegmentSumWithNumSegments
SparseSegmentSumWithNumSegments( const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input indices, ::tensorflow::Input segment_ids, ::tensorflow::Input num_segments )
Knoten
::tensorflow::Node * node() const
operator :: tensorflow :: Input
operator::tensorflow::Input() const
operator :: tensorflow :: Output
operator::tensorflow::Output() const