Programming Assignment: NMT with Attention (Tensorflow) - C4W1 Grading Issues

For some reason despite me passing all the test, the grading the gives error

There was a problem compiling the code from your notebook. Details: EagerTensor object has no attribute 'astype'. If you are looking for numpy-related methods, please run the following: from tensorflow.python.ops.numpy_ops import np_config np_config.enable_numpy_behavior()
I have try adding the code but it still doesn’t work. Can anybody help me with this issue?

Hi @LamNXHE181776,

This error occurs because the grader expects a numpy array, not a tf tensor. You can convert the tensor to a numpy array using the .numpy() method. If you still encounter issues, feel free to DM me your code.

Thank you, I have managed to solve it, turns out I was using tf.math.minimum() on rougue1_similarity instead of np.minimum(). The grader managed to work again.

2 Likes