Math
Note: Functions taking Tensor arguments can also take anything accepted by tf.convert_to_tensor.
[TOC]
Note: Elementwise binary operations in TensorFlow follow numpy-style broadcasting.
Arithmetic Operators
TensorFlow provides several operations that you can use to add basic arithmetic operators to your graph.
tf.addtf.subtracttf.multiplytf.scalar_multf.divtf.dividetf.truedivtf.floordivtf.realdivtf.truncatedivtf.floor_divtf.div_no_nantf.truncatemodtf.floormodtf.modtf.cross
Basic Math Functions
TensorFlow provides several operations that you can use to add basic mathematical functions to your graph.
tf.add_ntf.abstf.negativetf.signtf.reciprocaltf.squaretf.roundtf.sqrttf.rsqrttf.powtf.exptf.expm1tf.logtf.log1ptf.ceiltf.floortf.maximumtf.minimumtf.costf.sintf.lbetatf.tantf.acostf.asintf.atantf.coshtf.sinhtf.asinhtf.acoshtf.atanhtf.lgammatf.digammatf.erftf.erfctf.squared_differencetf.igammatf.igammactf.zetatf.polygammatf.betainctf.rint
Matrix Math Functions
TensorFlow provides several operations that you can use to add linear algebra functions on matrices to your graph.
tf.diagtf.diag_parttf.tracetf.transposetf.eyetf.matrix_diagtf.matrix_diag_parttf.matrix_band_parttf.matrix_set_diagtf.matrix_transposetf.matmultf.normtf.matrix_determinanttf.matrix_inversetf.choleskytf.cholesky_solvetf.matrix_solvetf.matrix_triangular_solvetf.matrix_solve_lstf.qrtf.self_adjoint_eigtf.self_adjoint_eigvalstf.svd
Tensor Math Function
TensorFlow provides operations that you can use to add tensor functions to your graph.
tf.tensordot
Complex Number Functions
TensorFlow provides several operations that you can use to add complex number functions to your graph.
tf.complextf.conjtf.imagtf.angletf.real
Reduction
TensorFlow provides several operations that you can use to perform common math computations that reduce various dimensions of a tensor.
tf.reduce_sumtf.reduce_prodtf.reduce_mintf.reduce_maxtf.reduce_meantf.reduce_alltf.reduce_anytf.reduce_logsumexptf.count_nonzerotf.accumulate_ntf.einsum
Scan
TensorFlow provides several operations that you can use to perform scans (running totals) across one axis of a tensor.
tf.cumsumtf.cumprod
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.segment_sum(c, tf.constant([0, 0, 1]))
==> [[0 0 0 0]
[5 6 7 8]]tf.segment_sumtf.segment_prodtf.segment_mintf.segment_maxtf.segment_meantf.unsorted_segment_sumtf.sparse_segment_sumtf.sparse_segment_meantf.sparse_segment_sqrt_n
Sequence Comparison and Indexing
TensorFlow provides several operations that you can use to add sequence comparison and index extraction to your graph. You can use these operations to determine sequence differences and determine the indexes of specific values in a tensor.
tf.argmintf.argmaxtf.setdiff1dtf.wheretf.uniquetf.edit_distancetf.invert_permutation
