tensorflow2.0基本操作
其他
2019-08-04 14:34:44
阅读次数: 0
Broadcasting (广播)
数学运算
outline
- +-*/
- **,pow,square
- sqrt
- //,%
- exp,log
- @,matmul
- linear layer
合并与分割
- tf.concat([],axis=)
- tf.stack([],axis=)
- tf.unstack([],axis=)
- tf.split([],axis=,num_or_size_splits=[])
- num_or_size_splits:分割成什么样
数据统计
- tf.norm([],ord=,axis=) # 张量范数
- 二范数:平方和开根号
- 一范数:绝对值的和
- ord:1,2
- tf.reduce_min/max/mean
- tf.argmax/argmin
- tf.equal(a,b)
- tf.unique
数据排序
- sort/argsort
- tf.sort([],direction='')
- tf.argsort :返回索引
- top_k
- tf.math.top_k()
- 应用:top-k accuracy
- top-5 acc.
填充与复制
- tf.pad
- 数据的填充
- tf.pad(a,[1,1],[1,1])
- tf.tile
- broadcast_to
张量限幅
- clip_by_value
- tf.maximum(a,2)
- tf.minimum(a,8)
- tf.clip_by_value(a,2,8)
- relu
- clip_by_norm
- gradient
高阶OP
转载自www.cnblogs.com/dhp-2016/p/11184213.html