Google ML Bootcamp/1. Neural Networks and Deep Learning
35. Getting your Matrix Dimensions Right
코딩소비
2023. 9. 9. 17:20

np.dot(W,x)가 진행되므로 해당 layer의 (output dim, input dim)으로 설정된다.
W[l].shape : (n[l], n[l-1])
b[l].shape : (n[l],1)
- element-wise 더하기를 진행해야하므로 W[l]와 b[l]은 차원이 같아야한다.

이때 np.dot(W,x)가 아니라 np.dot(W,X) 모든 훈련 예제에 대해 진행된다면
X.shape : (n[0],m)
- Z[l].shape : (n[l], m)
- z[l].shape : (n[l],1)
- b[l].shape : (n[l],1) but python boradcasting -> (n[l],m)으로 열 복사가 진행되므로 element-wise 연산 가능.

역전파 진행 시 dimension 계산할때.
dZ[l].shape : (n[l],m)