• 博客园logo
  • 会员
  • 周边
  • 众包
  • 新闻
  • 博问
  • 闪存
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
 






天生自然

 
 

Powered by 博客园
博客园 | 首页 | 新随笔 | 联系 | 订阅 订阅 | 管理

随笔分类 -  吴裕雄--天生自然TensorFlow2教程

1 2 下一页

 
吴裕雄--天生自然TensorFlow2教程:手写数字问题实战
摘要:import tensorflow as tf from tensorflow import keras from keras import Sequential,datasets, layers, optimizers, metrics def preprocess(x, y): """数据处理函 阅读全文
posted @ 2020-01-22 13:18 吴裕雄 阅读(262) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:函数优化实战
摘要:import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def himmeblau(x): return (x[0]**2 + x[1] - 11)**2 + (x[0] + 阅读全文
posted @ 2020-01-22 11:46 吴裕雄 阅读(247) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:反向传播算法
摘要: 阅读全文
posted @ 2020-01-22 11:34 吴裕雄 阅读(179) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:链式法则
摘要:import tensorflow as tf x = tf.constant(1.) w1 = tf.constant(2.) b1 = tf.constant(1.) w2 = tf.constant(2.) b2 = tf.constant(1.) with tf.GradientTape(p 阅读全文
posted @ 2020-01-22 11:28 吴裕雄 阅读(218) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:多输出感知机及其梯度
摘要:import tensorflow as tf x = tf.random.normal([2, 4]) w = tf.random.normal([4, 3]) b = tf.zeros([3]) y = tf.constant([2, 0]) with tf.GradientTape() as 阅读全文
posted @ 2020-01-22 11:23 吴裕雄 阅读(206) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:单输出感知机及其梯度
摘要:import tensorflow as tf x = tf.random.normal([1, 3]) w = tf.ones([3, 1]) b = tf.ones([1]) y = tf.constant([1]) with tf.GradientTape() as tape: tape.wa 阅读全文
posted @ 2020-01-22 11:12 吴裕雄 阅读(151) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:损失函数及其梯度
摘要:import tensorflow as tf x = tf.random.normal([2, 4]) w = tf.random.normal([4, 3]) b = tf.zeros([3]) y = tf.constant([2, 0]) with tf.GradientTape() as 阅读全文
posted @ 2020-01-22 11:05 吴裕雄 阅读(316) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:激活函数及其梯度
摘要:import tensorflow as tf a = tf.linspace(-10., 10., 10) a with tf.GradientTape() as tape: tape.watch(a) y = tf.sigmoid(a) grads = tape.gradient(y, [a]) 阅读全文
posted @ 2020-01-22 10:57 吴裕雄 阅读(185) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:梯度下降简介
摘要:import tensorflow as tf w = tf.constant(1.) x = tf.constant(2.) y = x * w with tf.GradientTape() as tape: tape.watch([w]) y2 = x * w grad1 = tape.grad 阅读全文
posted @ 2020-01-22 10:46 吴裕雄 阅读(344) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:误差计算
摘要:import tensorflow as tf y = tf.constant([1, 2, 3, 0, 2]) y = tf.one_hot(y, depth=4) # max_label=3种 y = tf.cast(y, dtype=tf.float32) out = tf.random.no 阅读全文
posted @ 2020-01-21 13:59 吴裕雄 阅读(187) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:输出方式
摘要:sigmoid out' = sigmoid(out) # 把输出值压缩在0-1 import tensorflow as tf a = tf.linspace(-6., 6, 10) a tf.sigmoid(a) x = tf.random.normal([1, 28, 28]) * 5 tf. 阅读全文
posted @ 2020-01-21 13:49 吴裕雄 阅读(300) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:全连接层
摘要:out = f(X@W + b) out = relut(X@W + b) import tensorflow as tf x = tf.random.normal([4, 784]) net = tf.keras.layers.Dense(512) out = net(x) out.shape n 阅读全文
posted @ 2020-01-21 13:39 吴裕雄 阅读(457) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:测试(张量)- 实战
摘要:import tensorflow as tf from tensorflow import keras from tensorflow.keras import datasets import os # do not print irrelevant information # os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' # x: [60k,28,28], 阅读全文
posted @ 2020-01-02 21:14 吴裕雄 阅读(552) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:数据加载
摘要:import tensorflow as tf from tensorflow import keras # train: 60k | test: 10k (x, y), (x_test, y_test) = keras.datasets.mnist.load_data() x.shape y.shape # 0纯黑、255纯白 x.min(), x.max(), x.mean() x_test. 阅读全文
posted @ 2020-01-02 20:50 吴裕雄 阅读(305) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:高阶操作
摘要:import tensorflow as tf a = tf.random.normal([3, 3]) a mask = a > 0 mask # 为True元素,即>0的元素的索引 indices = tf.where(mask) indices # 取回>0的值 tf.gather_nd(a, indices) A = tf.ones([3, 3]) B = tf.zeros([3, 3]) 阅读全文
posted @ 2020-01-02 16:52 吴裕雄 阅读(155) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:张量限幅
摘要:import tensorflow as tf a = tf.range(10) a # a中小于2的元素值为2 tf.maximum(a, 2) # a中大于8的元素值为8 tf.minimum(a, 8) # a中的元素值限制在[2,8]区间内 tf.clip_by_value(a, 2, 8) a = a - 5 a tf.nn.relu(a) tf.maximum(a, 0) 缩放时不改变 阅读全文
posted @ 2020-01-02 16:35 吴裕雄 阅读(157) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:填充与复制
摘要:import tensorflow as tf a = tf.reshape(tf.range(9), [3, 3]) a tf.pad(a, [[0, 0], [0, 0]]) tf.pad(a, [[ 1, 0, ], [0, 0]]) tf.pad(a, [[1, 1], [0, 0]]) tf.pad(a, [[1, 1], [1, 0]]) tf.... 阅读全文
posted @ 2020-01-02 16:08 吴裕雄 阅读(251) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:张量排序
摘要:import tensorflow as tf a = tf.random.shuffle(tf.range(5)) a tf.sort(a, direction='DESCENDING') # 返回索引 tf.argsort(a, direction='DESCENDING') idx = tf.argsort(a, direction='DESCENDING') tf.gath... 阅读全文
posted @ 2020-01-02 15:48 吴裕雄 阅读(312) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:数据统计
摘要:import tensorflow as tf a = tf.ones([2, 2]) a tf.norm(a) tf.sqrt(tf.reduce_sum(tf.square(a))) a = tf.ones([4, 28, 28, 3]) a.shape tf.norm(a) tf.sqrt(tf.reduce_sum(tf.square(a))) b = tf.ones([2, 2]) tf 阅读全文
posted @ 2020-01-02 15:29 吴裕雄 阅读(150) 评论(0) 推荐(0)
吴裕雄--天生自然TensorFlow2教程:合并与分割
摘要: 阅读全文
posted @ 2020-01-01 21:35 吴裕雄 阅读(239) 评论(0) 推荐(0)
 

1 2 下一页