# Module: tf.compat.v1.math

Math Operations.

TensorFlow provides a variety of math functions including:

See: 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. 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]]


## Modules

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

## Functions

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. (deprecated arguments)

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

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.

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

count_nonzero(...): Computes number of nonzero elements across dimensions of a tensor. (deprecated arguments) (deprecated arguments)

cumprod(...): Compute the cumulative product of the tensor x along axis.

cumsum(...): Compute the cumulative sum of the tensor x along axis.

cumulative_logsumexp(...): Compute the cumulative log-sum-exp of the tensor x along axis.

digamma(...): Computes Psi, the derivative of Lgamma (the log of the absolute value of

divide(...): Computes Python style division of x by y.

divide_no_nan(...): Computes a safe divide which returns 0 if the y is zero.

equal(...): Returns the truth value of (x == y) element-wise.

erf(...): Computes the Gauss error function of x element-wise.

erfc(...): Computes the complementary error function of x element-wise.

erfinv(...): Compute inverse error function.

exp(...): Computes exponential of x element-wise. $$y = e^x$$.

expm1(...): Computes exp(x) - 1 element-wise.

floor(...): Returns element-wise largest integer not greater than x.

floordiv(...): Divides x / y elementwise, rounding toward the most negative integer.

floormod(...): Returns element-wise remainder of division. When x < 0 xor y < 0 is

greater(...): Returns the truth value of (x > y) element-wise.

greater_equal(...): Returns the truth value of (x >= y) element-wise.

igamma(...): Compute the lower regularized incomplete Gamma function P(a, x).

igammac(...): Compute the upper regularized incomplete Gamma function Q(a, x).

imag(...): Returns the imaginary part of a complex (or real) tensor.

in_top_k(...): Says whether the targets are in the top K predictions.

invert_permutation(...)