C1_W3_Assignment_Exercise 5 - soft_dice_loss

Hello, i cant figure out why my code fails in some specific tests on soft_dice_loss function. this is the error i get:
Error: Wrong output for Test Case 2. One possible reason for error: make sure epsilon = 1
Error: Wrong output for Test Case 4. One possible reason for error: make sure epsilon = 1
Error: Wrong output for Test Case 5. One possible reason for error: make sure epsilon = 1
9 Tests passed
3 Tests failed


AssertionError Traceback (most recent call last)
in ()
6 ### do not edit anything below
7 sess = K.get_session()
----> 8 soft_dice_loss_test(soft_dice_loss, epsilon, sess)

~/work/W3A1/public_tests.py in soft_dice_loss_test(target, epsilon, sess)
412 ]
413
→ 414 multiple_test_dice(test_cases, target, sess)
415
416 ##############################################

~/work/W3A1/test_utils.py in multiple_test_dice(test_cases, target, sess)
183 print(‘\033[92m’, success," Tests passed")
184 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
→ 185 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 soft_dice_loss. Check your equations and avoid using global variables inside the function.

refer this post comment to understand what happens if you used global variables instead of local variables.

Based on your output for incorrect epsilon, you either have applied it multiple times or used the epsilon incorrectly.

1 Like