tensor的基本运算:
tf.add(x,y) return x + y
tf.substract(x,y) return x - y
tf.multiply(x,y) return x*y
tf.matmul(A,B) return A*B
tf.div(x,y) return x/y
tf.cumsum(x,axis) 累加
指数运算
tf.log(x)
tf.exp(x)
三角函数
tf.cos(x) tf.acos(x)
tf.sin(x) tf.asin(x)
tf.tan(x) tf.atan(x)
tf.tanh(x) tf.atanh(x)
类型转换
tf.cast(x, dtype)
求最值
tf.maximum(x,y) x,y 最大值
tf.minimum(x,y) x,y 最小值
tf.argmin(x) x最小值下标
tf.argmax(x) x最大值小标
变量和常量
tf.Variable(value, name)
tf.constant(value, name)
tf.constant_initializer(value) return initializer
tf.variables_initializer(var_list,name) Returns an Op that initializes a list of variables.
创建Tensor:
tf.random_normal(shape,mean,stddev,dtype) 正态分布
tf.random_uniform(shape,minval,maxval) 均匀分布
tf.zeros(shape)
tf.zeros_like(shape)
tf.ones(shape)
tf.ones_like(shape)
累计运算:
tf.reduce_mean(input, axis) 求均值 axis=0 列方向 1 行方向
tf.reduce_sum(input, axis) 求和 axis=0 列方向,1行方向,未指定,所有求和
tf.sigmoid(x) return y = 1 / (1 + exp(-x))