• Computes the sum along segments of a tf.Tensor.

    const x = tf.tensor1d([1, 2, 3, 4]);
    const segmentIds = tf.tensor1d([1, 2, 0, 1], 'int32');
    const numSegments = 3;

    x.unsortedSegmentSum(segmentIds, numSegments).print()
    //or tf.unsortedSegmentSum(x, segmentIds, numSegments)

    Type Parameters

    Parameters

    • x: TensorLike | T

      The tf.Tensor that will be summed along its segments.

    • segmentIds: TensorLike | Tensor1D

      A tf.Tensor1D whose rank is equal to the rank of x's dimension along the axis. Maps each element of x to a segment.

    • numSegments: number

      The number of distinct segmentIds.

    Returns T

    Doc

Generated using TypeDoc