- 博客(6)
- 资源 (1)
- 收藏
- 关注
原创 TensorFlow2.0——6、张量排序
sort 进行降序操作 argsort进行index位置降序操作 gather收集从大到小的排序 同理,二维一样 默认,axis=0 top_k res=tf . math.top_ k(a,2) res.indices ***** k=2,得到索引,将矩阵中每行最大两个元素的索引取出,按数字大小顺序进行排序,默认axis=0 **** top_k分为k值任取1.2.3...
2020-02-16 20:36:16 246
原创 TensorFlow2.0——5、合并与分割
tf.concat tf.split tf.stack tf.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. shape Out[7...
2020-02-16 16:49:02 259
原创 TensorFlow2.0——4、前向传播(张量)(mnist数据集)关于手写数字识别
import tensorflow as tf from tensorflow import keras from tensorflow.keras import datasets import os '''载入mnist database数据集''' (x,y),_ =datasets.mnist.load_data() # 设置x为Tensor的32位float型数据,x的指从[0,255...
2020-02-16 16:22:43 239
原创 Tensorflow2.0——3、Broadcasting
Broadcasting ■ expand ■ without copying data ■ VS tf.tile ■ tf. broadcast to key idea ■ Insert 1 dim ahead if needed ■ Expand dims with size 1 to same size Feature maps: [4, 32, 32, 3] Bias: [3]→[1,1,...
2020-02-16 10:44:29 140
原创 Tensorflow2.0——2、索引与切片
Basic indexing ●●● In [4]: a=tf.ones([1,5,5,3] ) //定义一个dim=4的tensor In [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 302
原创 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 316
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人