Operation是TensorFlow中的基本概念,中文翻译为操作,又简写为op。


TensorFlow主要的操作组以及对应的操作函数如下:


操作组操作
MathsAdd, Sub, Mul, Div, Exp, Log, Greater, Less, Equal
ArrayConcat, Slice, Split, Constant, Rank, Shape, Shuffle
MatrixMatMul, MatrixInverse, MatrixDeterminant
Neuronal NetworkSoftMax, Sigmoid, ReLU, Convolution2D, MaxPool
CheckpointingSave, Restore
Queues and syncronizationsEnqueue, Dequeue, MutexAcquire, MutexRelease
Flow controlMerge, Switch, Enter, Leave, NextIteration


Maths操作组


操作描述
tf.add(x, y, name=None)求和
tf.sub(x, y, name=None)减法
tf.mul(x, y, name=None)乘法
tf.div(x, y, name=None)除法
tf.mod(x, y, name=None)取模
tf.abs(x, name=None)求绝对值
tf.neg(x, name=None)取负 (y = -x).
tf.sign(x, name=None)返回符号 y = sign(x) = -1 if x < 0; 0 if x == 0; 1 if x > 0.
tf.inv(x, name=None)取反
tf.square(x, name=None)计算平方 (y = x * x = x^2).
tf.round(x, name=None)舍入最接近的整数
# ‘a’ is [0.9, 2.5, 2.3, -4.4]
tf.round(a) ==> [ 1.0, 3.0, 2.0, -4.0 ]
tf.sqrt(x, name=None)开根号 (y = \sqrt{x} = x^{1/2}).
tf.pow(x, y, name=None)幂次方 
# tensor ‘x’ is [[2, 2], [3, 3]]
# tensor ‘y’ is [[8, 16], [2, 3]]
tf.pow(x, y) ==> [[256, 65536], [9, 27]]
tf.exp(x, name=None)计算e的次方
tf.log(x, name=None)计算log,一个输入计算e的ln,两输入以第二输入为底
tf.maximum(x, y, name=None)返回最大值 (x > y ? x : y)
tf.minimum(x, y, name=None)返回最小值 (x < y ? x : y)
tf.cos(x, name=None)三角函数cosine
tf.sin(x, name=None)三角函数sine
tf.tan(x, name=None)三角函数tan
tf.atan(x, name=None)三角函数ctan

Array操作组