Week1 Assignment1 - failing hidden assignment

Hello
I am failing assignment 1, week 1. I pass all the cells internally in the notebook but I fail 2 cells. The autograder output shows that the test cases are hidden.

1 Like

There is a known bug that the unit tests in the notebook do not catch the error if you neglect to implement the “stride” in conv_forward and pool_forward. Please check very carefully your output values for the stride = 2 test case for pool_forward. They all need to agree, not just most of them. If they don’t, then this is probably what the problem is.

Hi, I have the same problem, I implement the stride as the formula but for case 2 :stride = 2,
my output only partially agree with the answer. Could you help please?

mode = max
A.shape = (2, 2, 2, 3)
A[0] =
 [[[1.74481176 0.90159072 1.65980218]
  [1.74481176 1.46210794 1.65980218]]

 [[1.14472371 0.90159072 2.10025514]
  [1.14472371 0.90159072 1.65980218]]]

mode = average
A.shape = (2, 2, 2, 3)
A[1] =
 [[[-0.17313416  0.32377198 -0.34317572]
  [ 0.03806347  0.07267063 -0.23026896]]

 [[ 0.44497696 -0.00261695 -0.31040307]
  [ 0.50811474 -0.23493734 -0.23961183]]]
Expected Output:

mode = max
A.shape = (2, 2, 2, 3)
A[0] =
 [[[1.74481176 0.90159072 1.65980218]
  [1.74481176 1.6924546  1.65980218]]

 [[1.13162939 1.51981682 2.18557541]
  [1.13162939 1.6924546  2.18557541]]]

mode = average
A.shape = (2, 2, 2, 3)
A[1] =
 [[[-0.17313416  0.32377198 -0.34317572]
  [ 0.02030094  0.14141479 -0.01231585]]

 [[ 0.42944926  0.08446996 -0.27290905]
  [ 0.15077452  0.28911175  0.00123239]]]

Thanks!

Here’s what I get for the stride = 2 case with the mistake of leaving out the stride:

mode = max
A.shape = (2, 2, 2, 3)
A[0] =
 [[[1.74481176 0.90159072 1.65980218]
  [1.74481176 1.46210794 1.65980218]]

 [[1.14472371 0.90159072 2.10025514]
  [1.14472371 0.90159072 1.65980218]]]

mode = average
A.shape = (2, 2, 2, 3)
A[1] =
 [[[-0.17313416  0.32377198 -0.34317572]
  [ 0.03806347  0.07267063 -0.23026896]]

 [[ 0.44497696 -0.00261695 -0.31040307]
  [ 0.50811474 -0.23493734 -0.23961183]]]

Notice that my incorrect results are the same as yours. So I think you should take another look at the stride logic. What is your score from the grader? The way you compute vert_start and horiz_start is the same in both the conv_forward and pool_forward logic.

Thanks, I got it. I didn’t include stride in the for loops. Now I hit 100/100.