假设:
矩阵层数为lll,所在层的node个数为n(l)n^{(l)}n(l),X: input, Y: output,样本个数为mmm,有以下的矩阵大小的计算方法:
W[l].shape=(n[l],n[l−1])W^{[l]}.shape = (n^{[l]}, n^{[l-1]})W[l].shape=(n[l],n[l−1])
X.shape=(n[0],1)X.shape = (n^{[0]}, 1)X.shape=(n[0],1)
Y.shape=(n[l],1)Y.shape = (n^{[l]}, 1)Y.shape=(n[l],1), l取层数最大值
Z[l]=W[l]A[l−1]+b[l]Z^{[l]}= W^{[l]}A^{[l-1]} + b^{[l]}Z[l]=W[l]A[l−1]+b[l]
A[l]=activation(Z[l])A^{[l]} = activation(Z^{[l]})A[l]=activation(Z[l])
Z[l].shape=A[l].shape=(n[l],m)Z^{[l]}.shape = A^{[l]}.shape = (n^{[l]}, m)Z[l].shape=A[l].shape=(n[l],m)
b[l].shape=(n[l],1)b^{[l]}.shape = (n^{[l]}, 1)b[l].shape=(n[l],1)
神经网络各参数矩阵大小的计算总结
于 2022-05-18 22:21:21 首次发布