Stay organized with collections
Save and categorize content based on your preferences.
tensorflow::ops::SegmentSumV2
#include <math_ops.h>
Computes the sum along segments of a tensor.
Summary
Read the section on segmentation for an explanation of segments.
Computes a tensor such that \(output_i = \sum_j data_j\) where sum is over j
such that segment_ids[j] == i
.
If the sum is empty for a given segment ID i
, output[i] = 0
.
Note that this op is currently only supported with jit_compile=True.
Args:
- scope: A Scope object
- segment_ids: A 1-D tensor whose size is equal to the size of
data
's first dimension. Values should be sorted and can be repeated. The values must be less than num_segments
.
Caution: The values are always validated to be sorted on CPU, never validated on GPU.
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
.
Public attributes
Public functions
node
::tensorflow::Node * node() const
operator::tensorflow::Input() const
operator::tensorflow::Output
operator::tensorflow::Output() const
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2023-03-23 UTC.
[[["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 2023-03-23 UTC."],[],[],null,["# tensorflow::ops::SegmentSumV2 Class Reference\n\ntensorflow::ops::SegmentSumV2\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 = \\\\sum_j data_j\\\\) where sum is over `j` such that `segment_ids[j] == i`.\n\nIf the sum is empty for a given segment ID `i`, `output[i] = 0`.\n\nNote that this op is currently only supported with jit_compile=True.\n\nArgs:\n\n- scope: A [Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope) object\n- segment_ids: A 1-D tensor whose size is equal to the size of `data`'s first dimension. Values should be sorted and can be repeated. The values must be less than `num_segments`.\n\n\u003cbr /\u003e\n\nCaution: The values are always validated to be sorted on CPU, never validated on GPU.\n\nReturns:\n\n- [Output](/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| [SegmentSumV2](#classtensorflow_1_1ops_1_1_segment_sum_v2_1ab0b3d08f26a526925b7419691cf9567e)`(const ::`[tensorflow::Scope](/api_docs/cc/class/tensorflow/scope#classtensorflow_1_1_scope)` & scope, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` data, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` segment_ids, ::`[tensorflow::Input](/api_docs/cc/class/tensorflow/input#classtensorflow_1_1_input)` num_segments)` ||\n\n| ### Public attributes ||\n|--------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------|\n| [operation](#classtensorflow_1_1ops_1_1_segment_sum_v2_1af02321fbf8d10718be068c65d4923924) | [Operation](/api_docs/cc/class/tensorflow/operation#classtensorflow_1_1_operation) |\n| [output](#classtensorflow_1_1ops_1_1_segment_sum_v2_1a8b2f8d17b47b6d51499cb15f6da93b62) | `::`[tensorflow::Output](/api_docs/cc/class/tensorflow/output#classtensorflow_1_1_output) |\n\n| ### Public functions ||\n|--------------------------------------------------------------------------------------------------------------------------|------------------------|\n| [node](#classtensorflow_1_1ops_1_1_segment_sum_v2_1a1e3329f6142d66551c53e132491cb06c)`() const ` | `::tensorflow::Node *` |\n| [operator::tensorflow::Input](#classtensorflow_1_1ops_1_1_segment_sum_v2_1aba4391e5dc0a26711f9f0e237bcd4260)`() const ` | |\n| [operator::tensorflow::Output](#classtensorflow_1_1ops_1_1_segment_sum_v2_1a3c4e56b12d511c9650fbb946aa80e528)`() 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### SegmentSumV2\n\n```gdscript\n SegmentSumV2(\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```"]]