Help protect the Great Barrier Reef with TensorFlow on Kaggle Join Challenge

Module: tf.math

Math Operations.

TensorFlow provides a variety of math functions including:

See: tf.linalg for matrix and tensor functions.

About Segmentation

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. The segment_ids tensor should be the size of the first dimension, d0, with consecutive IDs in the range 0 to k, where k<d0. In particular, a segmentation of a matrix tensor is a mapping of rows to segments.

For example:

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]]

The standard segment_* functions assert that the segment indices are sorted. If you have unsorted indices use the equivalent unsorted_segment_ function. These functions take an additional argument num_segments so that the output tensor can be efficiently allocated.

c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
tf.math.unsorted_segment_sum(c, tf.constant([0, 1, 0]), num_segments=2)
# ==> [[ 6,  8, 10, 12],
#       [-1, -2, -3, -4]]


special module: Public API for tf.math.special namespace.


abs(...): Computes the absolute value of a tensor.

accumulate_n(...): Returns the element-wise sum of a list of tensors.

acos(...): Computes acos of x element-wise.

acosh(...): Computes inverse hyperbolic cosine of x element-wise.

add(...): Returns x + y element-wise.

add_n(...): Adds all input tensors element-wise.

angle(...): Returns the element-wise argument of a complex (or real) tensor.

argmax(...): Returns the index with the largest value across axes of a tensor.

argmin(...): Returns the index with the smallest value across axes of a tensor.

asin(...): Computes the trignometric inverse sine of x element-wise.

asinh(...): Computes inverse hyperbolic sine of x element-wise.

atan(...): Computes the trignometric inverse tangent of x element-wise.

atan2(...): Computes arctangent of y/x element-wise, respecting signs of the arguments.

atanh(...): Computes inverse hyperbolic tangent of x element-wise.

bessel_i0(...): Computes the Bessel i0 function of x element-wise.

bessel_i0e(...): Computes the Bessel i0e function of x element-wise.

bessel_i1(...): Computes the Bessel i1 function of x element-wise.

bessel_i1e(...): Computes the Bessel i1e function of x element-wise.

betainc(...): Compute the regularized incomplete beta integral \(I_x(a, b)\).

bincount(...): Counts the number of occurrences of each value in an integer array.

ceil(...): Return the ceiling of the input, element-wise.

confusion_matrix(...): Computes the confusion matrix from predictions and labels.

conj(...): Returns the complex conjugate of a complex number.

cos(...): Computes cos of x element-wise.