Computes a tensor such that \(output[i] = {j...} data[j...]\) where the sum is over tuples j... such that segment_ids[j...] == i. Unlike SegmentSum, segment_ids need not be sorted and need not cover all values in the full range of valid values.
If the sum is empty for a given segment ID i, output[i] = 0. If the given segment ID i is negative, the value is dropped and will not be added to the sum of the segment.
num_segments should equal the number of distinct segment IDs.
segment_ids: A tensor whose shape is a prefix of data.shape.
Returns:
Output: Has same shape as data, except for the first segment_ids.rank dimensions, which are replaced with a single dimension which has size num_segments.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2020-04-20 UTC."],[],[],null,["# tensorflow::ops::UnsortedSegmentSum Class Reference\n\ntensorflow::ops::UnsortedSegmentSum\n===================================\n\n`#include \u003cmath_ops.h\u003e`\n\nComputes the sum along segments of a tensor.\n\nSummary\n-------\n\nRead [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#Segmentation) for an explanation of segments.\n\nComputes a tensor such that \\\\(output\\[i\\] = {j...} data\\[j...\\]\\\\) where the sum is over tuples `j...` such that `segment_ids[j...] == i`. Unlike [SegmentSum](/versions/r2.0/api_docs/cc/class/tensorflow/ops/segment-sum#classtensorflow_1_1ops_1_1_segment_sum), `segment_ids` need not be sorted and need not cover all values in the full range of valid values.\n\nIf the sum is empty for a given segment ID `i`, `output[i] = 0`. If the given segment ID `i` is negative, the value is dropped and will not be added to the sum of the segment.\n\n`num_segments` should equal the number of distinct segment IDs.\n\n\n\u003cbr /\u003e\n\n\n```gdscript\nc = tf.constant([[1,2,3,4], [5,6,7,8], [4,3,2,1]])\ntf.unsorted_segment_sum(c, tf.constant([0, 1, 0]), num_segments=2)\n# ==\u003e [[ 5, 5, 5, 5],\n# [5, 6, 7, 8]]\n```\n\n\u003cbr /\u003e\n\nArguments:\n\n- scope: A [Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- segment_ids: A tensor whose shape is a prefix of `data.shape`.\n\n\u003cbr /\u003e\n\nReturns:\n\n- [Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output): Has same shape as data, except for the first `segment_ids.rank` dimensions, which are replaced with a single dimension which has size `num_segments`.\n\n\u003cbr /\u003e\n\n| ### Constructors and Destructors ||\n|---|---|\n| [UnsortedSegmentSum](#classtensorflow_1_1ops_1_1_unsorted_segment_sum_1a523a2af71c68956739def8e73da562ce)`(const ::`[tensorflow::Scope](/versions/r2.0/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` data, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` segment_ids, ::`[tensorflow::Input](/versions/r2.0/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` num_segments)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_unsorted_segment_sum_1abea8a0230165d39d5462f3b026641a87) | [Operation](/versions/r2.0/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_unsorted_segment_sum_1ace1d27d6d7cc362c688e1a08ea92c40f) | `::`[tensorflow::Output](/versions/r2.0/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_unsorted_segment_sum_1aeb60f49f613fc351fc9cc30a55a66486)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_unsorted_segment_sum_1a11030ed77273925e7bbdf6ba24defdd9)`() const ` | ` ` ` ` |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_unsorted_segment_sum_1ac3c5ac1a7b8d9c7b5047dff05040dff1)`() const ` | ` ` ` ` |\n\nPublic attributes\n-----------------\n\n### operation\n\n```text\nOperation operation\n``` \n\n### output\n\n```text\n::tensorflow::Output output\n``` \n\nPublic functions\n----------------\n\n### UnsortedSegmentSum\n\n```gdscript\n UnsortedSegmentSum(\n const ::tensorflow::Scope & scope,\n ::tensorflow::Input data,\n ::tensorflow::Input segment_ids,\n ::tensorflow::Input num_segments\n)\n``` \n\n### node\n\n```gdscript\n::tensorflow::Node * node() const \n``` \n\n### operator::tensorflow::Input\n\n```gdscript\n operator::tensorflow::Input() const \n``` \n\n### operator::tensorflow::Output\n\n```gdscript\n operator::tensorflow::Output() const \n```"]]