Thanks for tuning in to Google I/O. View all sessions on demand

# SegmentSumV2

public final class SegmentSumV2

Computes the sum along segments of a tensor.

Read [the section on segmentation](https://tensorflow.org/api_docs/python/tf/math#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.

### Public Methods

 Output asOutput() Returns the symbolic handle of a tensor. static SegmentSumV2 create(Scope scope, Operand data, Operand segmentIds, Operand numSegments) Factory method to create a class wrapping a new SegmentSumV2 operation. Output 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 Methods

#### public Output<T> asOutput()

Returns the symbolic handle of a tensor.

Inputs to TensorFlow operations are outputs of another TensorFlow operation. This method is used to obtain a symbolic handle that represents the computation of the input.

#### public static SegmentSumV2<T> create(Scope scope, Operand<T> data, Operand<U> segmentIds, Operand<V> numSegments)

Factory method to create a class wrapping a new SegmentSumV2 operation.

##### Parameters
scope current scope 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
• a new instance of SegmentSumV2

#### public Output<T> 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.

[]
[]