Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

反向传播(选做), 最后算出来答案对不上,其实也没太搞明白卷积网络的反向传播,知道的麻烦解释一下,谢谢! #10

Open
lyy-zz opened this issue Mar 28, 2018 · 1 comment

Comments

@lyy-zz
Copy link

lyy-zz commented Mar 28, 2018

The assign of the first week of Lesson 4 5.2.3 Putting it together: Pooling backward
Change Part:

                        # Set dA_prev to be dA_prev + (the mask multiplied by the correct entry of dA) (≈1 line)
                        dA_prev[i, vert_start: vert_end, horiz_start: horiz_end, c] += np.multiply(mask, dA[i, h, w, c])
                        # Get the value a from dA (≈1 line)
                        da = dA[i, h, w, c]
                        # Distribute it to get the correct slice of dA_prev. i.e. Add the distributed value of da. (≈1 line)
                        dA_prev[i, vert_start: vert_end, horiz_start: horiz_end, c] += distribute_value(da, shape)

The Reason:
Pooling Layer 前向传播是一个slice对应一个scalar,所以在反向传播的时候应该是一个scalar对应一个slice。multiply mask and the scalar 再与对应slice相加能够刚好把error传递给最大值;distribute_value与对应slice相加,能够将error 平均分给slice中的每个值,最终实现精准传播误差的目的。
不知道自己有没有描述清楚,@marsggbo谢谢分享作业!!!

@xuxinhang
Copy link

我也是看到作业对不上过来的😉

矩阵乘标量,可以理解为矩阵把dZ这个标量分流了。最大池化呢,就是指dZ是完全由那个最大值带来的,所以矩阵只有一个1。平均池化就是表示dz是由那四项等权重引起的,所以是四个1/4。或许以后会有其他类型的池化,道理或许相同吧。

谢谢楼上的issue,谢谢 @marsggbo 的分享

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants