Problems with jupiter notebook

ID of the laboratory work : nwuqozhejyyp
I am unable to complete the programming assignments of the third week, namely Exercise 4 - initialise_parameters.
The screenshot shows the problem.
Знімок екрана 2023-11-20 175535

Check the previous lines of code just before the syntax error marker. Look for mis-matched parenthesis, etc.

1 Like

Hello Myroslava,

your code initialization for parameter is incorrect due to syntax error occurs when the interpreter shows invalid syntax on executing the Python code . A syntax error occurs due to missed reserved keywords, spaces, quotes placed improperly, indentations and incorrect usage of blocks, invalid declarations, and if the function calls and definitions aren’t done properly.

if you notice while def initialise_parameters, each parameter are mentioned with some shape

Initializes parameters to build a neural network with TensorFlow. The shapes are:
W1 : [25, 12288]
b1 : [25, 1]
W2 : [12, 25]
b2 : [12, 1]
W3 : [6, 12]
b3 : [6, 1]

So how would you initialise each parameter with the help of below instructions

Implement the function below to take in a shape and to return an array of numbers using the GlorotNormal initializer.

  • tf.keras.initializers.GlorotNormal(seed=1)
  • tf.Variable(initializer(shape=())

Also notice your initialiser has already been recalled
initializer = tf.keras.initializers.GlorotNormal(seed=1)

so only implement your code with right function and shape.

check if there was no change made outside of ###START AND YOUR CODE ENDS HERE##

Hope you get the hint!!.

Regards
DP

Since the code shown is below the “YOUR CODE ENDS HERE” text, wasn’t that code provided with the notebook?

1 Like

Tom yes this part of the code is already provided.

It can be a space syntax error but as I haven’t seen her complete code, I just gave her detail issue to check upon.

Regards
DP