C2 Week 1 Assignment Basic tensor operations

Getting the following error again and again RecursionError Traceback (most recent call last)
in
1 tmp_array = np.arange(1, 10)
----> 2 x = tf_square(tmp_array)
3 print(“tf_square output:\n”, x)
4
5 # Expected output:

in tf_square(array)
8
9 ### START CODE HERE ###
—> 10 tf_squared_array = tf_square(array)
11 ### END CODE HERE ###
12 return tf_squared_array

… last 1 frames repeated, from the frame below …

in tf_square(array)
8
9 ### START CODE HERE ###
—> 10 tf_squared_array = tf_square(array)
11 ### END CODE HERE ###
12 return tf_squared_array

RecursionError: maximum recursion depth exceeded while calling a Python object
Please help urgently

Please do not post your code on the forum. That is not allowed by the Code of Conduct.

Be careful usng the = sign.

One = means assignment.

Two == means a logical text.

hi @jayalakshmi

you are using incorrect tf function recall. remember there is a difference when we use tf.constant and tf_constant.

tf.constant is a variable recall function where as tf_constant isn’t in tensorflow.

implicate same correction for the error you counter while you used tf_square.

1 Like