Week 1, assignment 1 pool_forward

Hi, on the pool_forward exercise I have 4 out of 6 corrected results. What may be wrong on my code? thanks

4 Tests passed
2 Tests failed

@Iostos:
Please edit your message and remove the code. Posting your code isn’t allowed by the course Honor Code.

In the if-statements, there is no variable in this exercise named “a_slice_prev”. I think you have a typo there.

1 Like

Thanks, I did correct the typo but still can’t get all the results right. I’m getting this “AssertionError: Not all tests were passed for pool_forward. Check your equations and avoid using global variables inside the function.” Any other advice?

Sorry, I don’t recall seeing any other problems in your code.

There have been some changes in the notebook for this exercise since I completed it, so I don’t have the current copy available for testing.

Facing the same problem.

------OUTPUT-------
mode = max
A.shape = (2, 3, 3, 3)
A[1, 1] =
[[ 0.44497696 -0.00261695 -0.31040307]
[ 0.50811474 -0.23493734 -0.23961183]
[ 0.11872677 0.17255229 -0.22112197]]

mode = average
A.shape = (2, 3, 3, 3)
A[1, 1] =
[[0. 0. 0.]
[0. 0. 0.]
[0. 0. 0.]]
Error: Wrong output in MAX-Pool for variable in position 0.
Error: Wrong output in AVG-Pool for variable in position 0.
4 Tests passed
2 Tests failed

I had a similar issue.

Fixed it by making sure to slice into channel c when defining a_slice_prev.

Otherwise, the function will take the max or mean of all channels.

1 Like