Course 2 Week 3 Initialize parameter

b1=tf.Variable(initializer(shape=(25, 1))
^
SyntaxError: invalid syntax
I have tried everything but I am still getting this error. Any solutions?

I count to 3 parentheses on the left but only 2 on the right, try adding 1 on the left :slight_smile:

2 Likes

No. Its not working. I am still getting error.

It is really stressing me out. I even tried to make mistake in W1=tf.Variable… but still it showed me error on b1
Is there problem with kernel or something?

1 Like

No, it’s a problem in your code. You probably have mismatching parentheses on more than one line. Check the line before the b1 line. You can use the editor in the notebook to check for matching parens.

2 Likes

You have to understand how the python interpreter works. If it gets to the end of a line and it’s still looking for a close paren, then it just goes on to the next line and it only throws the syntax error when it sees something that doesn’t agree with the remaining syntax from the previous line. That is what causes the error to get thrown at the beginning of the b1 line. Note that as Jonas pointed out, you’ve got an error later on that line as well, but that’s not the one it’s actually complaining about. That’s why it didn’t fix the error when you fixed the parens on the b1 line.

1 Like

The hint tf.Variable(initializer(shape=()) missing one parenthesis. :sweat_smile:

1 Like