I also had this problem on week 4. I used the same formula, and had deviations of less than about .001, so I wasn’t sure if I was using the seed wrong somewhere or something like that. I noticed in the comment that it mentions a small deviation should be permitted, but looking through the unittests, it doesn’t look like this tolerance is added in… that being said, with the random_seed being set, I think that exactness shouldn’t be a problem, I’m just not sure what the issue is after having confirmed that all other unittests for all of the supporting functions pass (presumably verifying that my gradient computations are right).
In my case there was a problem in previous function, back_prop, which passed the test but was wrong and that’s why i was getting wrong result for this one.