The following code is giving me the following error. I think it has something to do with the tf.function decorator, but I am not positive.
Z1 = tf.math.add(tf.linalg.matmul(W1, X), b1)
A1 = tf.keras.activations.relu(Z1)
Z2 = tf.math.add(tf.linalg.matmul(W2, X), b2)
A2 = tf.keras.activations.relu(Z2)
Z3 = tf.math.add(tf.linalg.matmul(W3, X), b3)
ValueError: Attempt to convert a value (<tensorflow.python.eager.def_function.Function object at 0x7f3aa834e710>) with an unsupported type (<class ‘tensorflow.python.eager.def_function.Function’>) to a Tensor.
Hi, @Cameron_Conroy.
There is an error in the expressions for Z2
and Z3
. Can you spot it? Look at the comments in forward_propagation
.
Hi @Cameron_Conroy. I am not sure about the source of this error. Can you provide a bit more code, specifically what you send on input as X? Also note that you might want to correct your usages of X
as inputs in the code you attached
1 Like
I cannot spot the error. I couldn’t find anything in the comments
@yanivh gave you a good hint 
#(approx. 5 lines) # Numpy Equivalents:
# Z1 = ... # Z1 = np.dot(W1, X) + b1
# A1 = ... # A1 = relu(Z1)
# Z2 = ... # Z2 = np.dot(W2, A1) + b2
# A2 = ... # A2 = relu(Z2)
# Z3 = ... # Z3 = np.dot(W3, A2) + b3
It’s not the error I was expecting to see from that code 
I fixed it. Thanks for the pointer 
1 Like
Wonderful
Good luck with the rest of the assignment.
That’s what I wrote
YOUR CODE STARTS HERE
Z1 = tf.math.add(tf.linalg.matmul(W1, X), b1)
A1 = tf.keras.activations.relu(Z1)
Z2 = tf.math.add(tf.linalg.matmul(W2, A1), b2)
A2 = tf.keras.activations.relu(Z2)
Z3 = tf.math.add(tf.linalg.matmul(W3, A2), b3)
It runs well I guess, But after running the last cell this error comes up instead of
expected values:
NameError Traceback (most recent call last)
in
18 print("\033[92mAll test passed")
19
—> 20 forward_propagation_test(forward_propagation, new_train)
NameError: name ‘new_train’ is not defined
Where did I go wrong? Can you help ?
1 Like
I tried running the cells from top now its not showing error. Lol
1 Like
thank you for your guidance