|TensorFlow 1 version|
TensorFlow provides a variety of math functions including:
- Basic arithmetic operators and trigonometric functions.
- Special math functions (like:
- Complex number functions (like:
- Reductions and scans (like:
- Segment functions (like:
tf.linalg for matrix and tensor functions.
TensorFlow provides several operations that you can use to perform common
math computations on tensor segments.
Here a segmentation is a partitioning of a tensor along
the first dimension, i.e. it defines a mapping from the first dimension onto
segment_ids tensor should be the size of
the first dimension,
d0, with consecutive IDs in the range
In particular, a segmentation of a matrix tensor is a mapping of rows to
c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]]) tf.math.segment_sum(c, tf.constant([0, 0, 1])) # ==> [[0 0 0 0] # [5 6 7 8]]