Course 1, Week 1, assignment conv_single_step


I have a question regarding, the assignment, where you have to compute a single step of convolution. In the exercise you have to cast the result of an array with only one element as a float. I tried different ways of casting to float, but it always returns the error, that I need to cast to float (see image). When I check the data type it shows that it is class float (see image). What am I doing wrong? Or am I casting to a wrong float?


Hi @Roman_Fabrik
You just need to follow the comments. Anyway, to help you understand what to do, you can do a debug, printing the types of Z and b. So, add this line to your code
print(type(Z), type(b))
This will help you understand what is going on and how to correctly complete the code.
Keep learning!

Here is the comment from the notebook:

# Add bias b to Z. Cast b to a float() so that Z results in a scalar value.

Only cast b as a float and the Z will be in scalar automatically. And, after making the changes, you have to run the cell again to update the changes.

Thank you for the help, after reloading the kernel it suddenly worked.