TensorFlow学习笔记1.3: math函数 API r1.7

http://devdocs.io/tensorflow~python/math_ops

Math

Note: Functions taking Tensor arguments can also take anything accepted by tf.convert_to_tensor.
接受Tensor参数的函数 也可以接受 tf.convert_to_tensor的任何参数。
Note: Elementwise binary operations in TensorFlow follow numpy-style broadcasting.
TensorFlow中的Elementwise二进制操作遵循numpy-style广播。

Arithmetic Operators 算术运算

TensorFlow provides several operations that you can use to add basic arithmetic operators to your graph.

容易记住的:tf.add tf.subtract tf.multiply tf.div tf.mod

用到时候再去查资料的:
tf.scalar_mul
tf.divide tf.truediv tf.floordiv tf.realdiv tf.truncatediv tf.floor_div
tf.truncatemod tf.floormod
tf.cross

Basic Math Functions 基本数学函数

TensorFlow provides several operations that you can use to add basic mathematical functions to your graph.

常用函数:

tf.abs tf.negative tf.sign tf.square tf.round tf.sqrt tf.pow tf.exp tf.log tf.maximum tf.minimum

三角函数:

tf.cos tf.sin tf.tan tf.acos tf.asin tf.atan tf.cosh tf.sinh tf.asinh tf.acosh tf.atanh
用到时候再去查资料的:
tf.add_n tf.reciprocal tf.rsqrt tf.expm1 tf.log1p tf.ceil tf.floor tf.lbeta
tf.lgamma tf.digamma tf.erf tf.erfc tf.squared_difference tf.igamma
tf.igammac tf.zeta tf.polygamma tf.betainc tf.rint

Matrix Math Functions 矩阵数学函数

TensorFlow provides several operations that you can use to add linear algebra functions on matrices to your graph.

tf.matmul

tf.diag tf.diag_part
tf.trace tf.transpose
tf.eye
tf.matrix_diag tf.matrix_diag_part tf.matrix_band_part tf.matrix_set_diag tf.matrix_transpose
tf.norm
tf.matrix_determinant tf.matrix_inverse
tf.cholesky tf.cholesky_solve
tf.matrix_solve tf.matrix_triangular_solve tf.matrix_solve_ls
tf.qr
tf.self_adjoint_eig tf.self_adjoint_eigvals
tf.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 perform common math computations that reduce various dimensions of a tensor.
tf.complex
tf.conj
tf.imag
tf.angle
tf.real

Reduction

TensorFlow provides several operations that you can use to perform common math computations that reduce various dimensions of a tensor.

tf.reduce_sum

tf.reduce_prod
tf.reduce_min
tf.reduce_max

tf.reduce_mean

tf.reduce_all
tf.reduce_any
tf.reduce_logsumexp
tf.count_nonzero
tf.accumulate_n
tf.einsum

Scan

TensorFlow provides several operations that you can use to perform scans (running totals) across one axis of a tensor.
tf.cumsum
tf.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_sum
tf.segment_prod
tf.segment_min
tf.segment_max
tf.segment_mean
tf.unsorted_segment_sum
tf.sparse_segment_sum
tf.sparse_segment_mean
tf.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.argmin
tf.argmax
tf.setdiff1d
tf.where
tf.unique
tf.edit_distance
tf.invert_permutation

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • TF API数学计算tf...... :math(1)刚开始先给一个运行实例。tf是基于图(Graph)的计算系统...
    MachineLP阅读 4,132评论 0 1
  • 原文链接:machinethink.net/blog/tensorflow-on-ios/ Before you ...
    dopami阅读 1,124评论 0 1
  • “喂。您好!我是嘉禾。” 整个通电话的过程中,嘉禾都只是“嗯,嗯”的应承着,嘴角带着笑意。等她挂了电话以后,其他三...
    疏影梅花阅读 596评论 0 4
  • 有些事情 是随着人的遗忘,而真的消失了 这世上,再无“蓉儿” 也许这本该是早已接受的结局 可能潜意识害怕这样的事发...
    queeny23阅读 469评论 0 0
  • 20171116 【幸福三朵玫瑰】 昨日 3朵玫瑰 1.早起 2.阅读✅ 3.接当当✅ 今日3朵玫瑰 1.早起 2...
    叶青丁当妈阅读 330评论 0 0

友情链接更多精彩内容