tf module

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))
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值