W2_A1_Normalizing rows (x)

normalizeRows(x) = [[5. ]
[7.28010989]]
Error: Wrong shape
Error: Wrong output
1 Tests passed
2 Tests failed

AssertionError Traceback (most recent call last)
in
3 print("normalizeRows(x) = " + str(normalize_rows(x)))
4
----> 5 normalizeRows_test(normalize_rows)

~/work/release/W2A1/public_tests.py in normalizeRows_test(target)
162 ]
163
β†’ 164 test(test_cases, target)
165
166 def softmax_test(target):

~/work/release/W2A1/test_utils.py in test(test_cases, target)
24 print(β€˜\033[92m’, success," Tests passed")
25 print(β€˜\033[91m’, len(test_cases) - success, " Tests failed")
β€”> 26 raise AssertionError(β€œNot all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))

AssertionError: Not all tests were passed for normalize_rows. Check your equations and avoid using global variables inside the function.

I need help

Hello Joshua,

Welcome to the community and thank you for your question.

Please go through the instructions carefully given in the notebook again. The code has already been provided for you. Avoid using β€œin place” operators.

You can follow this thread to look more deeper.

Yes, as Rashmi suggests, you should have another careful look at the instructions. The point of this function is that the output matrix should be the same shape as the input matrix. The difference will be that each row of the output matrix will have norm of 1, right? Your output value is not the same shape as the input: it is 2 x 1. You can see by examining the test cell that the input is 2 x 3. So why did that happen? It looks like you are simply returning the norms of the rows, but that is not the goal here, right?

1 Like