Course 2 week 2 programming assign: ZeroDivisionError

Hi,
So i have been getting a ZeroDivisionError error for 6.1,6.2,6.3 part of the assignment.The error orignates from backward_propagation method which is implimented as a default. It occures in “dz3 = 1./m * (a3 - Y)” line which implies that m=0 as this is the only denaminator. Let me know a solution.
PFA the screenshot

Well, there’s only one division operation in that line of code, so it seems pretty clear where to look for the problem: how could the value of m end up being zero there? If you passed an empty minibatch, right? Hmmmmm. I suggest you put some print statements in your minibatch code to show the sizes of each.

Note that you can find the source for the backward_propagation function if you want to see how it works. Just click “File → Open” and then open the file opt_utils_v1a.py. I found that name by looking at the “import” cell early in the notebook. Even though you did not write that code, it can still throw an error if you pass it incorrect arguments. So you start from the point of the error and then work your way backward to figure out the real bug, which is higher up the call stack.

@paulinpaloalto thanks for the help. The issue was in my implimentation of “random_mini_batches” that genrates the inputs for the back pop step ,thus m = 0

Glad to hear that you found the solution! Thanks for confirming.