吴裕雄--天生自然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(persistent=True) as tape:
tape.watch([w1, b1, w2, b2])
y1 = x * w1 + b1
y2 = y1 * w2 + b2 dy2_dy1 = tape.gradient(y2, [y1])[0]
dy1_dw1 = tape.gradient(y1, [w1])[0]
dy2_dw1 = tape.gradient(y2, [w1])[0]
dy2_dy1 * dy1_dw1
dy2_dw1
吴裕雄--天生自然TensorFlow2教程:链式法则的更多相关文章
- 吴裕雄--天生自然TensorFlow2教程:手写数字问题实战
import tensorflow as tf from tensorflow import keras from keras import Sequential,datasets, layers, ...
- 吴裕雄--天生自然TensorFlow2教程:函数优化实战
import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D def himme ...
- 吴裕雄--天生自然TensorFlow2教程:反向传播算法
- 吴裕雄--天生自然TensorFlow2教程:多输出感知机及其梯度
import tensorflow as tf x = tf.random.normal([2, 4]) w = tf.random.normal([4, 3]) b = tf.zeros([3]) ...
- 吴裕雄--天生自然TensorFlow2教程:单输出感知机及其梯度
import tensorflow as tf x = tf.random.normal([1, 3]) w = tf.ones([3, 1]) b = tf.ones([1]) y = tf.con ...
- 吴裕雄--天生自然TensorFlow2教程:损失函数及其梯度
import tensorflow as tf x = tf.random.normal([2, 4]) w = tf.random.normal([4, 3]) b = tf.zeros([3]) ...
- 吴裕雄--天生自然TensorFlow2教程:激活函数及其梯度
import tensorflow as tf a = tf.linspace(-10., 10., 10) a with tf.GradientTape() as tape: tape.watch( ...
- 吴裕雄--天生自然TensorFlow2教程:梯度下降简介
import tensorflow as tf w = tf.constant(1.) x = tf.constant(2.) y = x * w with tf.GradientTape() as ...
- 吴裕雄--天生自然TensorFlow2教程:误差计算
import tensorflow as tf y = tf.constant([1, 2, 3, 0, 2]) y = tf.one_hot(y, depth=4) # max_label=3种 y ...
随机推荐
- html集合
<!DOCTYPE> //声明文档类型 <!DOCTYPE> 声明必须是 HTML 文档的第一行,位于 <html> 标签之前. <!DOCTYPE> ...
- goahead web 服务器
https://blog.csdn.net/xieyihua1994/article/details/74002413
- LED Decorative Light Supplier - Decorative Use Of LED Light Strips
Led strip refers to the led assembly in the ribbon of the FPC (flexible circuit board) or PCB hard b ...
- EAC3 Adaptive Hybrid Transform (AHT)
adaptive hybrid transform 由两个linear transforms级联组成. 第一个transform为MDCT,MDCT使用KBD window产生256个transfor ...
- hadoop之mr框架的源码理解注意点
1.reduce源码中的 GroupComparable和SecondaryComparable到底都是干什么的 理解点1: 源码位置 理解点 secondaryComparable这个是可以对map ...
- 一段讯飞、百度等语音识别API无法识别的语音最终解决办法
最近在做语音识别.字幕扒词相关的工作,遇到了一段录音(https://download.csdn.net/download/u014220286/12169183,各位有兴趣的可以下载下来试试),音质 ...
- 路飞-自定义User表和Media配置
user模块User表 创建user模块 """ 前提:在 luffy 虚拟环境下 1.终端从项目根目录进入apps目录 >: cd luffyapi & ...
- 左偏树(p4431)
难得不是左偏树,而是思维: 这道题在做得时候,有两个性质 1.如果a是一个不下降序列,那么b[i]==a[i]时取得最优解. 2.如果a是一个严格递减序列,则取a序列的中位数x,令b[1]=b[2]= ...
- Vue 高德地图 路径规划 画点
CDN 方式 <!--引入高德地图JSAPI --> <script src="//webapi.amap.com/maps?v=1.4.13&key=您申请的ke ...
- 非分页中的上一篇下一篇sql语句如何写
上一页:where id=(select max(id) from examination where id < #{id} and class=#{class}) 下一页:where id=( ...