Math

Math

Note: Functions taking Tensor arguments can also take anything accepted by tf.convert_to_tensor.
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.

Basic Math Functions

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

Matrix Math Functions

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

Tensor Math Function

TensorFlow provides operations that you can use to add tensor functions to your graph.

Complex Number Functions

TensorFlow provides several operations that you can use to add complex number functions to your graph.

Reduction

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

Scan

TensorFlow provides several operations that you can use to perform scans (running totals) across one axis of a tensor.

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

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.

© 2017 The TensorFlow Authors. All rights reserved.
Licensed under the Creative Commons Attribution License 3.0.
Code samples licensed under the Apache 2.0 License.
https://www.tensorflow.org/api_guides/python/math_ops

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部