矩阵求导的基本法则
标量对标量
...
标量对向量
f
xp×1=(x1,x2,…,xp)T
∂x∂fp×1=(∂x1∂f,∂x2∂f,…,∂xp∂f)T
向量对标量
fm×1=(f1,f2,…,fm)T
x
∂x∂f1×m=(∂x∂f1,∂x∂f2,…,∂x∂fm)
向量对向量
fm×1=(f1,f2,…,fm)T
xp×1=(x1,x2,…,xp)T
∂x∂fp×m=∂x1∂f1∂x2∂f1⋮∂xp∂f1∂x1∂f2∂x2∂f2⋮∂xp∂f2⋯⋯⋱⋯∂x1∂fm∂x1∂fm⋮∂xp∂fm
标量对矩阵
f
xp×q=x11x21⋮xp1x12x22⋮xp2⋯⋯⋱⋯x1qx2q⋮xpq
∂x∂fp×q=∂x11∂f∂x21∂f⋮∂xp1∂f∂x12∂f∂x22∂f⋮∂xp2∂f⋯⋯⋱⋯∂x1q∂f∂x2q∂f⋮∂xpq∂f
矩阵对标量
fm×n=f11f21⋮fm1f12f22⋮fm2⋯⋯⋱⋯f1nf2n⋮fmn
x
∂x∂fn×m=∂x∂f11∂x∂f12⋮∂x∂f1n∂x∂f21∂x∂f22⋮∂x∂f2n⋯⋯⋱⋯∂x∂fm1∂x∂fm2⋮∂x∂fmn
更高维度的
...
Reference