Convolution_model_Step_by_Step_v1 A1

I am stuck in this exercise for a while and unable to figure out where am I doing wrong . Staff please guide me into this .
PS: I know I have added the code snippet but I will delete once I get it correc

Here are a couple of hints:

  1. Initialization of Z is incorrect.
  2. vert_end is incorrect
  3. a_slice_prev is incorrect. Look at the way conv_single_step is invoked.

Sir,

I am getting almost value of Z equal to that is required. But I am getting assertion error :- “You must cast the output to float”.
I have been doing " Z= Z.astype(np.float64)" still it is showing to cast the output to float.
Kindly help.

If You are referring to conv_single_step, keep in mind that Z should be a scalar with shape () and not (1, 1, 1). Please use print(Z.shape) to fix your code.

Also, print(type(Z)) should not produce numpy.ndarray in the output. It should be something like numpy.float64.

Sir

I now am getting exact answer that to scalar but is still asking for casting output to float. Please help.

What’s the output of print(type(Z)) ?

Its showing <class ‘float’>

Look at the test. It should be np.float64 or np.float32. If the value of Z matches the expected value, you are close to the solution.

Actually i converted Z to scalar using np.asscalar. After that it is showing error when I am using Z.astype(np.float64).

Use numpy.float64 along with numpy.asscalar