Week3 - Linear Function exercise

My function returns the correct result for Y, but I am also getting the following error.

AssertionError: Use the TensorFlow API

Can anyone help?

Hi, @fabian.

You’re probably not using tf.constant to initialize X, W and b. Look at the example provided for X.

Thank you for your response.
I am using tf.constant(np.ra…) t initialize X,W and b
and tf.Variable(np.ra…) for Y.
I’m also getting the correct output vector for Y, but I also get this weird error message (and 0 on the grade).

Just assign the tensor that results from computing W X + b to Y. There is no need to create a randomly initialized TensorFlow variable for it :slight_smile:

P.S. The error message is indeed misleading. The notebook raises that exception because it is expecting a tensor and you’re probably returning a variable.

3 Likes

Yes - that works.
Thank you!

Glad to help! Good luck with the rest of the assignment :slight_smile: