tensorflow::ops::SparseSegmentSum
#include <math_ops.h>
Вычисляет сумму по разреженным сегментам тензора.
Краткое описание
Прочитайте раздел о сегментации для объяснения сегментов.
Подобно SegmentSum, но segment_ids может иметь ранг меньше, чем ранг data в первом измерении, выбирая подмножество нулевого измерения, указанное indices.
Например:
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
# Select two rows, one segment. tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 0])) # => [[0 0 0 0]]
# Select two rows, two segment. tf.sparse_segment_sum(c, tf.constant([0, 1]), tf.constant([0, 1])) # => [[ 1 2 3 4] # [-1 -2 -3 -4]]
# Select all rows, two segments. tf.sparse_segment_sum(c, tf.constant([0, 1, 2]), tf.constant([0, 0, 1])) # => [[0 0 0 0] # [5 6 7 8]]
# Which is equivalent to: tf.segment_sum(c, tf.constant([0, 0, 1]))
Аргументы:
- scope: Объект Scope
- indices: 1-мерный тензор. Имеет такой же ранг, как и
segment_ids. - segment_ids: 1-мерный тензор. Значения должны быть отсортированы и могут повторяться.
Возвращает:
-
Output: Имеет такую же форму, как и данные, за исключением нулевого измерения, которое имеет размерk, число сегментов.
| Конструкторы и деструкторы | |
|---|---|
SparseSegmentSum(const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input indices, ::tensorflow::Input segment_ids) |
| Общедоступные атрибуты | |
|---|---|
operation | |
output | |
| Общедоступные функции | |
|---|---|
node() const | ::tensorflow::Node * |
operator::tensorflow::Input() const | |
operator::tensorflow::Output() const | |
Общедоступные атрибуты
операция
Operation operation
выход
::tensorflow::Output output
Общедоступные функции
SparseSegmentSum
SparseSegmentSum( const ::tensorflow::Scope & scope, ::tensorflow::Input data, ::tensorflow::Input indices, ::tensorflow::Input segment_ids )
узел
::tensorflow::Node * node() const
оператор::tensorflow::Вход
operator::tensorflow::Input() const
оператор::tensorflow::Выход
operator::tensorflow::Output() const
© 2020 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 4.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/versions/r2.4/api_docs/cc/class/tensorflow/ops/sparse-segment-sum