Course 2, week 1: Programming Assignment 3: Gradient checking

{moderator edit - solution code removed}

While executing above code i am getting error:

I am not able to figure,why it is showing the broadcasting error as the shape of the of theta_plus is (47,1) already?

But the point is you are trying to update just one element of theta_plus, right? You step through the vector and fiddle with one element in each iteration of the main loop. It might be worth having another careful look at the instructions for this section.

Also please note that you posted this in “General Discussions”. These Discourse forums support at least 5 different deeplearning.ai specializations at last count and it’s growing by the day. You’ll have better luck if you post it under the relevant course. I’ve moved it for you to DLS - Course 2 by using the little “edit pencil” tool on the title of the post.

In each iteration of the loop, I am updating the vector having size (47,1) by adding the epsilon value. But I am not able to understand, why is it not able to broadcast this epsilon into the vector. Everything seems to be in order, I have seen it several times.

Thank you, @paulinpaloalto for moving my post from the general section to the specific section of the problem.

Epsilon is a scalar value and you are adding it one element of a (47,1) vector in each iteration. I’ve deleted your code from the forum post, but what I remember was that you were assigning an entire (47,1) vector (the right hand side of your assignment) to one element of a (47,1) vector on the left side of your assignment statement. That is why that error is being thrown.

Thanks, @paulinpaloalto. Yes, it was the problem that you pointed out and i was able to solved it.