Dimension of dropout matrix

It is written that dropout matrix should have same dimensions as A1. Since dimensions of b1 are (20,1) it means that dimensions of A1 are also (20,1) or (20,m) because of broadcasting. However when I try putting that as dimesnisons i am getting bugs. I put dimensions of (2,5) and it works but I dont understand how are that dimensions of A1???

The point is not to “hard-code” the dimensions to anything in particular, right? We are trying to write “general” code here that works in all cases. So why not base it on the “shape” attribute of A1? Or A2 as the case may be.