目录

* Derivative Rules
<https://www.cnblogs.com/nickchen121/p/10914433.html#derivative-rules>
* Chain rule <https://www.cnblogs.com/nickchen121/p/10914433.html#chain-rule>
Derivative Rules



Chain rule
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 <tf.Tensor: id=132, shape=(), dtype=float32, numpy=2.0> dy2_dw1
<tf.Tensor: id=138, shape=(), dtype=float32, numpy=2.0>

友情链接
KaDraw流程图
API参考文档
OK工具箱
云服务器优惠
阿里云优惠券
腾讯云优惠券
华为云优惠券
站点信息
问题反馈
邮箱:[email protected]
QQ群:637538335
关注微信