前向传播(forward pass)指的是:按顺序(从输入层到输出层)计算和存储神经网络中每层的结果。
反向传播(backward propagation或backpropagation)指的是计算神经网络参数梯度的方法。简 言之,该方法根据微积分中的链式规则,按相反的顺序从输出层到输入层遍历网络。该算法存储了 计算某些参数梯度时所需的任何中间变量(偏导数)。
计算图:具体直接看实例,图1,图2,图3
问题:前向传播具体是计算什么?存储什么?反向传播怎么计算梯度?
图1(即图4.7.1)来自《动手学深度学习》一书。本节主要内容均来自此书对应章节。 简单网络(单隐藏层网络)相对应的计算图,其中正方形表示变量,圆圈表示操作符。左下角表示输 入,右上角表示输出。注意显示数据流的箭头方向主要是向右和向上的。
图2 Computational graph of the BatchNorm-Layer. From left to right, following the black
arrows flows the forward pass. The inputs are a matrix X and gamma and beta as vectors.
From right to left, following the red arrows flows the backward pass which distributes
the gradient from above layer to gamma and beta and all the way back to the input.
(来自此博客)