本篇主要内容就是矩阵标量函数的求导,基本思路就是:
给标量函数套上迹trace;
利用迹和矩阵微分的性质进行化简,化简到 df=tr((∂f∂x)Tdx) d f = t r ( ( ∂ f ∂ x ) T d x ) 就可以了
然后就可以得到 ∂f∂x ∂ f ∂ x 了
因此,在深度学习中,假如loss是L2 Norm,也就是
f=loss=‖‖aN−y‖‖22
f
=
l
o
s
s
=
‖
a
N
−
y
‖
2
2
,那么
∂f∂aL=2(a−y)
∂
f
∂
a
L
=
2
(
a
−
y
)
下面贴上参考资料: