tensorflow::ops::SparseSegmentSumWithNumSegments
#include <math_ops.h>
Вычисляет сумму по разреженным сегментам тензора.
Краткое описание
Подобно SparseSegmentSum, но допускает отсутствие идентификаторов в segment_ids. Если идентификатор отсутствует, соответствующий тензор 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]]Аргументы:
- scope: Объект Scope
- indices: 1-мерный тензор. Имеет тот же ранг, что и
segment_ids. - segment_ids: 1-мерный тензор. Значения должны быть отсортированы и могут повторяться.
- num_segments: Должен быть равен количеству различных идентификаторов сегментов.
Возвращаемое значение:
-
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 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
© 2022 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/api_docs/cc/class/tensorflow/ops/sparse-segment-sum-with-num-segments