Tensorflow.js tf.unsortedSegmentSum() Function
Tensorflow.js is an open-source library that is developed by Google for running machine learning models as well as deep learning neural networks in the browser or node environment.
The .unsortedSegmentSum() function is used to calculate the sum through the parts of a tf.Tensor.
tf.unsortedSegmentSum(x, segmentIds, numSegments)
- x: It is the stated tensor input that is to be added through its parts and it can be of type tf.Tensor, TypedArray, or Array.
- segmentIds: It is the stated tf.Tensor1D whose order is equivalent to the order of x’s size through the axis. It maps every item of x to a slice. It can be of type tf.Tensor1D, TypedArray, or Array.
- numSegments: It is the stated number of separate segmentIds, and it is of type number.
Return Value: It returns tf.Tensor object.
Tensor [8, 6, 7, 5]
Tensor [9, 1, 0]