Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/tensorflow/_api/v2/math/__init__.py: 100%
134 statements
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
« prev ^ index » next coverage.py v7.4.0, created at 2024-01-03 07:57 +0000
1# This file is MACHINE GENERATED! Do not edit.
2# Generated by: tensorflow/python/tools/api/generator/create_python_api.py script.
3"""Math Operations.
5Note: Functions taking `Tensor` arguments can also take anything accepted by
6`tf.convert_to_tensor`.
8Note: Elementwise binary operations in TensorFlow follow [numpy-style
9broadcasting](http://docs.scipy.org/doc/numpy/user/basics.broadcasting.html).
11TensorFlow provides a variety of math functions including:
13* Basic arithmetic operators and trigonometric functions.
14* Special math functions (like: `tf.math.igamma` and `tf.math.zeta`)
15* Complex number functions (like: `tf.math.imag` and `tf.math.angle`)
16* Reductions and scans (like: `tf.math.reduce_mean` and `tf.math.cumsum`)
17* Segment functions (like: `tf.math.segment_sum`)
19See: `tf.linalg` for matrix and tensor functions.
21<a id=Segmentation></a>
23## About Segmentation
25TensorFlow provides several operations that you can use to perform common
26math computations on tensor segments.
27Here a segmentation is a partitioning of a tensor along
28the first dimension, i.e. it defines a mapping from the first dimension onto
29`segment_ids`. The `segment_ids` tensor should be the size of
30the first dimension, `d0`, with consecutive IDs in the range `0` to `k`,
31where `k<d0`.
32In particular, a segmentation of a matrix tensor is a mapping of rows to
33segments.
35For example:
37```python
38c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
39tf.math.segment_sum(c, tf.constant([0, 0, 1]))
40# ==> [[0 0 0 0]
41# [5 6 7 8]]
42```
44The standard `segment_*` functions assert that the segment indices are sorted.
45If you have unsorted indices use the equivalent `unsorted_segment_` function.
46These functions take an additional argument `num_segments` so that the output
47tensor can be efficiently allocated.
49``` python
50c = tf.constant([[1,2,3,4], [-1,-2,-3,-4], [5,6,7,8]])
51tf.math.unsorted_segment_sum(c, tf.constant([0, 1, 0]), num_segments=2)
52# ==> [[ 6, 8, 10, 12],
53# [-1, -2, -3, -4]]
54```
57"""
59import sys as _sys
61from . import special
62from tensorflow.python.ops.bincount_ops import bincount
63from tensorflow.python.ops.check_ops import is_non_decreasing
64from tensorflow.python.ops.check_ops import is_strictly_increasing
65from tensorflow.python.ops.confusion_matrix import confusion_matrix
66from tensorflow.python.ops.gen_array_ops import invert_permutation
67from tensorflow.python.ops.gen_math_ops import acosh
68from tensorflow.python.ops.gen_math_ops import asin
69from tensorflow.python.ops.gen_math_ops import asinh
70from tensorflow.python.ops.gen_math_ops import atan
71from tensorflow.python.ops.gen_math_ops import atan2
72from tensorflow.python.ops.gen_math_ops import atanh
73from tensorflow.python.ops.gen_math_ops import betainc
74from tensorflow.python.ops.gen_math_ops import cos
75from tensorflow.python.ops.gen_math_ops import cosh
76from tensorflow.python.ops.gen_math_ops import digamma
77from tensorflow.python.ops.gen_math_ops import erf
78from tensorflow.python.ops.gen_math_ops import erfc
79from tensorflow.python.ops.gen_math_ops import expm1
80from tensorflow.python.ops.gen_math_ops import floor_mod as floormod
81from tensorflow.python.ops.gen_math_ops import floor_mod as mod
82from tensorflow.python.ops.gen_math_ops import greater
83from tensorflow.python.ops.gen_math_ops import greater_equal
84from tensorflow.python.ops.gen_math_ops import igamma
85from tensorflow.python.ops.gen_math_ops import igammac
86from tensorflow.python.ops.gen_math_ops import is_finite
87from tensorflow.python.ops.gen_math_ops import is_inf
88from tensorflow.python.ops.gen_math_ops import is_nan
89from tensorflow.python.ops.gen_math_ops import less
90from tensorflow.python.ops.gen_math_ops import less_equal
91from tensorflow.python.ops.gen_math_ops import lgamma
92from tensorflow.python.ops.gen_math_ops import log
93from tensorflow.python.ops.gen_math_ops import log1p
94from tensorflow.python.ops.gen_math_ops import logical_and
95from tensorflow.python.ops.gen_math_ops import logical_not
96from tensorflow.python.ops.gen_math_ops import logical_or
97from tensorflow.python.ops.gen_math_ops import maximum
98from tensorflow.python.ops.gen_math_ops import minimum
99from tensorflow.python.ops.gen_math_ops import neg as negative
100from tensorflow.python.ops.gen_math_ops import next_after as nextafter
101from tensorflow.python.ops.gen_math_ops import polygamma
102from tensorflow.python.ops.gen_math_ops import reciprocal
103from tensorflow.python.ops.gen_math_ops import rint
104from tensorflow.python.ops.gen_math_ops import segment_max
105from tensorflow.python.ops.gen_math_ops import segment_mean
106from tensorflow.python.ops.gen_math_ops import segment_min
107from tensorflow.python.ops.gen_math_ops import segment_prod
108from tensorflow.python.ops.gen_math_ops import segment_sum
109from tensorflow.python.ops.gen_math_ops import sin
110from tensorflow.python.ops.gen_math_ops import sinh
111from tensorflow.python.ops.gen_math_ops import square
112from tensorflow.python.ops.gen_math_ops import squared_difference
113from tensorflow.python.ops.gen_math_ops import tan
114from tensorflow.python.ops.gen_math_ops import tanh
115from tensorflow.python.ops.gen_math_ops import unsorted_segment_max
116from tensorflow.python.ops.gen_math_ops import unsorted_segment_min
117from tensorflow.python.ops.gen_math_ops import unsorted_segment_prod
118from tensorflow.python.ops.gen_math_ops import unsorted_segment_sum
119from tensorflow.python.ops.gen_math_ops import xlogy
120from tensorflow.python.ops.gen_math_ops import zeta
121from tensorflow.python.ops.gen_nn_ops import softsign
122from tensorflow.python.ops.math_ops import abs
123from tensorflow.python.ops.math_ops import accumulate_n
124from tensorflow.python.ops.math_ops import acos
125from tensorflow.python.ops.math_ops import add
126from tensorflow.python.ops.math_ops import add_n
127from tensorflow.python.ops.math_ops import angle
128from tensorflow.python.ops.math_ops import argmax_v2 as argmax
129from tensorflow.python.ops.math_ops import argmin_v2 as argmin
130from tensorflow.python.ops.math_ops import ceil
131from tensorflow.python.ops.math_ops import conj
132from tensorflow.python.ops.math_ops import count_nonzero_v2 as count_nonzero
133from tensorflow.python.ops.math_ops import cumprod
134from tensorflow.python.ops.math_ops import cumsum
135from tensorflow.python.ops.math_ops import cumulative_logsumexp
136from tensorflow.python.ops.math_ops import div_no_nan as divide_no_nan
137from tensorflow.python.ops.math_ops import divide
138from tensorflow.python.ops.math_ops import equal
139from tensorflow.python.ops.math_ops import erfcinv
140from tensorflow.python.ops.math_ops import erfinv
141from tensorflow.python.ops.math_ops import exp
142from tensorflow.python.ops.math_ops import floor
143from tensorflow.python.ops.math_ops import floordiv
144from tensorflow.python.ops.math_ops import imag
145from tensorflow.python.ops.math_ops import log_sigmoid
146from tensorflow.python.ops.math_ops import logical_xor
147from tensorflow.python.ops.math_ops import multiply
148from tensorflow.python.ops.math_ops import multiply_no_nan
149from tensorflow.python.ops.math_ops import ndtri
150from tensorflow.python.ops.math_ops import not_equal
151from tensorflow.python.ops.math_ops import polyval
152from tensorflow.python.ops.math_ops import pow
153from tensorflow.python.ops.math_ops import real
154from tensorflow.python.ops.math_ops import reciprocal_no_nan
155from tensorflow.python.ops.math_ops import reduce_all
156from tensorflow.python.ops.math_ops import reduce_any
157from tensorflow.python.ops.math_ops import reduce_euclidean_norm
158from tensorflow.python.ops.math_ops import reduce_logsumexp
159from tensorflow.python.ops.math_ops import reduce_max
160from tensorflow.python.ops.math_ops import reduce_mean
161from tensorflow.python.ops.math_ops import reduce_min
162from tensorflow.python.ops.math_ops import reduce_prod
163from tensorflow.python.ops.math_ops import reduce_std
164from tensorflow.python.ops.math_ops import reduce_sum
165from tensorflow.python.ops.math_ops import reduce_variance
166from tensorflow.python.ops.math_ops import round
167from tensorflow.python.ops.math_ops import rsqrt
168from tensorflow.python.ops.math_ops import scalar_mul_v2 as scalar_mul
169from tensorflow.python.ops.math_ops import sigmoid
170from tensorflow.python.ops.math_ops import sign
171from tensorflow.python.ops.math_ops import sobol_sample
172from tensorflow.python.ops.math_ops import softplus
173from tensorflow.python.ops.math_ops import sqrt
174from tensorflow.python.ops.math_ops import subtract
175from tensorflow.python.ops.math_ops import truediv
176from tensorflow.python.ops.math_ops import unsorted_segment_mean
177from tensorflow.python.ops.math_ops import unsorted_segment_sqrt_n
178from tensorflow.python.ops.math_ops import xdivy
179from tensorflow.python.ops.math_ops import xlog1py
180from tensorflow.python.ops.nn_impl import l2_normalize
181from tensorflow.python.ops.nn_impl import zero_fraction
182from tensorflow.python.ops.nn_ops import approx_max_k
183from tensorflow.python.ops.nn_ops import approx_min_k
184from tensorflow.python.ops.nn_ops import in_top_k_v2 as in_top_k
185from tensorflow.python.ops.nn_ops import log_softmax_v2 as log_softmax
186from tensorflow.python.ops.nn_ops import softmax_v2 as softmax
187from tensorflow.python.ops.nn_ops import top_k
188from tensorflow.python.ops.special_math_ops import bessel_i0
189from tensorflow.python.ops.special_math_ops import bessel_i0e
190from tensorflow.python.ops.special_math_ops import bessel_i1
191from tensorflow.python.ops.special_math_ops import bessel_i1e
192from tensorflow.python.ops.special_math_ops import lbeta