Course 1, Week 4, Assignment 1, Exercise 5

That’s just a suggestion of the type of error to look for. I would say it’s more likely an error in how you handle the output layer. That is outside the “for” loop, right?

One thing that is a good idea in a case like this is to start by working out the “dimensional analysis”, so that you know what should be happening at each layer. Please have a look at this thread and I’ll bet that will shed some light …