Been looking at the code for 2 weeks but can’t find the issues. According to the error, the shape of a_slice_prev is probably wrong:
Week 1 has two assignments, name of the assignment??
it’s the first one, thanks!
s = …(a_slice_prev, W) what np function did you apply for this code?
okay your error log tells
your Z code is incorrect, remove that extra tuple for s, it should be only (s) and for the next code line for Z where you add bias it should be float64 and not float only
Update if issue has been addressed
Regards
DP
i used a_slice_prev*W directly. The single step convo showed correct when executed.
I checked the float function, but don’t see a way to change it to float64
just before the s code notice this line
Element-wise product between a_slice_prev and W. Do not add the bias yet.
# s = None
You convolve a 3x3 filter with the image by multiplying its values element-wise with the original matrix, so you need to use np.multiply for the s = np.multiply(A_slice_prev, W)
as the code line mentions here
Add bias b to Z. Cast b to a float() so that Z results in a scalar value.
# Z = None
so Z = Z + float64(b)
I’ve changed the tuple on the s, using the np.multiply function, also changed the float to float64 (float64 does not work, instead used np.float64()). But still the same error. The convo single step function should not be the problem here, I believe it is the shape of a_slice_prev that’s wrong, because the error shows it as a (3,2,4) shape where the correct shape should be (3,3,4).
I did with the same and I passed all the cells.
what code you applied zero pad?
did you use this hint
a = np.pad(a, ((0,0), (1,1), (0,0), (3,3), (0,0)), mode='constant', constant_values = (0,0))
Same code you showed there, my padding and single convo function all passed the test.
Please share your notebook in personal DM. Let me have a look where assignment must have gone wrong
P.S it is not totally same as the hint for zero pad there is slight difference
No problem, how do I share the notebook without copy paste the whole thing?
Click on my name, then click on message, and DM the notebook. Before that you must have download or saved the copy of your notebook as it is instructed before starting any assignment
Just because the error is thrown in conv_single_step
does not mean that is where the actual bug is, right? The problem is your code is passing incorrectly shaped objects to conv_single_step
. The bug is in your conv_forward
code. The most common errors have to do with not managing the stride correctly. Here’s a post that gives a good description of how the algorithm works.
Thanks! Yes, this is what i thought too, must be a problem in the con_forward code. I actually went through that post before posting my question, but I think the stride is worth investigating, will look deeper into it.
Hello,
- your codes for dimensions of the CONV output volume are incorrect
- vert_end and horiz_end codes are incorrect.
- Filter and output neuron code is incorrect.
Regards
DP
Hi Deepti,
Thanks for the help, the problem was only the vert_end.
Thanks, you were right, my vert_end was not correct, the way I debugged it was just going through some examples of different filter size and stride.