I have been working on UNQ_C1 without much success. I do have a couple of questions:
- I am missing something in the sub-volume calculation but cannot decipher it based on the output and generated error message:
Image:
z = 0
[[0. 0. 0. 0.]
[0. 0. 0. 0.]
[0. 0. 0. 0.]
[0. 0. 0. 0.]]
z = 1
[[0. 0. 0. 0.]
[0. 1. 2. 3.]
[0. 2. 4. 6.]
[0. 3. 6. 9.]]
z = 2
[[ 0. 0. 0. 0.]
[ 0. 2. 4. 6.]
[ 0. 4. 8. 12.]
[ 0. 6. 12. 18.]]
Label:
z = 0
[[0. 0. 0. 0.]
[0. 0. 0. 0.]
[0. 0. 0. 0.]
[0. 0. 0. 0.]]
z = 1
[[1. 1. 1. 1.]
[1. 1. 1. 1.]
[1. 1. 1. 1.]
[1. 1. 1. 1.]]
z = 2
[[2. 2. 2. 2.]
[2. 2. 2. 2.]
[2. 2. 2. 2.]
[2. 2. 2. 2.]]
Extracting (2, 2, 2) sub-volume
Error: Wrong output. for variable in position 0.
Sampled Image:
z = 0
[[0. 0.]
[1. 2.]]
z = 1
[[0. 0.]
[2. 4.]]
Sampled Label:
class = 0
z = 0
[[1. 1.]
[1. 1.]]
z = 1
[[0. 0.]
[0. 0.]]
class = 1
z = 0
[[0. 0.]
[0. 0.]]
z = 1
[[1. 1.]
[1. 1.]]
2 Tests passed
1 Tests failed
AssertionError Traceback (most recent call last)
in ()
1 ### test cell ex1 - do not modify this test cell
----> 2 get_sub_volume_test(get_sub_volume)
~/work/W3A1/public_tests.py in get_sub_volume_test(target)
68 ]
69
—> 70 learner_func_sample_image, learner_func_sample_label = multiple_test_get_sub_volume(test_cases, target)
71
72 print(“\033[0m\nSampled Image:”)
~/work/W3A1/test_utils.py in multiple_test_get_sub_volume(test_cases, target)
160 print(‘\033[92m’, success," Tests passed")
161 print(‘\033[91m’, len(test_cases) - success, " Tests failed")
→ 162 raise AssertionError(“Not all tests were passed for {}. Check your equations and avoid using global variables inside the function.”.format(target.name))
163
164 return learner_func_answer
AssertionError: Not all tests were passed for get_sub_volume. Check your equations and avoid using global variables inside the function.
- I was able to complete the remainder of the lab despite not being able to calculate a sub-volume. However, the assignment grader script did not seem to recognize this as evident in the automated feedback. Perhaps I’m missing something, but the subsequent questions did not seem dependent upon this specific result.
Many thanks in advance for yoru patience and help. Cheers!