Problem in Assignment 2 (Week 1)

Hi,
I am facing problem in understanding dimensions of our variable in this assignment.
In this assignment, layers_dims = [X.shape[0], 20, 3, 1] so this means layer 1 has 20 nodes, layer 2 has 3 nodes and layer 3 has 1 node. Therefore according to my understanding, W1 dimensions should be (n1,n0) which is (20, 2). Here 2 are input features in this assignment but when I check in my programming assignment, it gives W1 dimensions as (2,3). All other variable dimensions are not making sense as well. I dont think so this is because regularization is applied. I even tried without regularization and it gave same result.


Can anyone from mentors check and explain this?
Thanks in advance.

I suggest you look at the details of the actual test case. You’ll find that it does not use the same layers_dims that we use for the “real” problem. Normally we try to write “general” code here, so that it works with any inputs, although they are slightly cheating here by hard-wiring the number of layers to be 3 here just to keep the logic a bit simpler and not require multiple layers of subroutines as we had in the fully general code in C1 W4.

Click “File → Open” and then open the file public_tests.py and have a look around. The test cases may use different dimensions than the “real” implementation in the notebook.