- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 TensorFlow2.0——6、张量排序
sort 进行降序操作argsort进行index位置降序操作gather收集从大到小的排序同理,二维一样默认,axis=0top_kres=tf . math.top_ k(a,2)res.indices*****k=2,得到索引,将矩阵中每行最大两个元素的索引取出,按数字大小顺序进行排序,默认axis=0****top_k分为k值任取1.2.3...
2020-02-16 20:36:16
335
原创 TensorFlow2.0——5、合并与分割
tf.concattf.splittf.stacktf.unstack注意(axis=?)tf.concat合并操作除了axis可以不同,其他必须相同In [3]: a=tf. ones([4,35,8])In [4]: b=tf.ones([2,35,8])In [6]: c=tf.concat([a,b],axis=0)In [7]: C. shapeOut[7...
2020-02-16 16:49:02
337
原创 TensorFlow2.0——4、前向传播(张量)(mnist数据集)关于手写数字识别
import tensorflow as tffrom tensorflow import kerasfrom tensorflow.keras import datasetsimport os'''载入mnist database数据集'''(x,y),_ =datasets.mnist.load_data()# 设置x为Tensor的32位float型数据,x的指从[0,255...
2020-02-16 16:22:43
317
原创 Tensorflow2.0——3、Broadcasting
Broadcasting■ expand■ without copying data■ VS tf.tile■ tf. broadcast tokey idea■ Insert 1 dim ahead if needed■ Expand dims with size 1 to same sizeFeature maps: [4, 32, 32, 3]Bias: [3]→[1,1,...
2020-02-16 10:44:29
223
原创 Tensorflow2.0——2、索引与切片
Basic indexing●●●In [4]: a=tf.ones([1,5,5,3] ) //定义一个dim=4的tensorIn [5]: a[0][0] //取出2维向量,形状5行3列<tf.Tensor: id=16, shape=(5, 3),dtype= float32, numpy=array([[1., 1., 1.], [1., 1., 1.], ...
2020-02-15 17:03:27
400
原创 Tensorflow2.0——1、创建Tensor
tf.zeros( shape, dtype=tf.float32, name=None)tensor = tf.constant([[1, 2, 3], [4, 5, 6]])tf.zeros_like(tensor) # [[0, 0, 0], [0, 0, 0]]tensor:一个张量.dtype:返回的张量的类型,必须是以下类型之一:float16...
2020-02-15 14:04:14
401
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅