计算梯度的方法+BackPropagation

2019-02-15  本文已影响0人  我好菜啊_

参考cs231n与这位的博文https://www.zhihu.com/people/will-55-30/posts?page=1 非常感谢!


为找到最好的W,即使Li最小的W,使用梯度下降法
梯度是偏导数组成的向量
计算梯度->更新W 循环迭代进行这个过程
计算梯度有两个方法


minibatch
每次迭代时只选取一小部分样本来进行运算


back propagation求gradient
每个节点出的gradient都是local gradient乘以后一个节点的gradient



可以将好几个节点合并



当一个节点前向影响好几个分支时

模块化的实现,对于网络中的每个节点都有一个前向API用于计算loss,后向API用于计算梯度



CNN中的每一层的实现其实也就是这样一个个模块化的forward/backward API
forward: compute result of an operation and save any intermediates needed for gradient computation in memory
backward: apply the chain rule to compute the gradient of the loss function with respect to the inputs

上一篇 下一篇

猜你喜欢

热点阅读