Error in Deep Q-Learning - Lunar Lander

So I passed all the test but I keep getting this error (attached) in input 16. Also my internet connection is not great…so I was wondering whether that may be a factor…?

Hi there!
So, the error is very specific…
The variable “optimizer” is not an object, it a TUPLE. Try to review your code and check what are you doing with this variable. If you want to, you can share your code in my DM. Do not share here, its against the rules!

Hope it helps.

1 Like

Hey Lukas. Thank you for your response. I sent you a message a few days ago as you offered (or it may be 2 messages as I’m not sure if you received the first one as I didn’t see any confirmation). The code with the tuple error came with the assignment and I don’t think it was part of the test. Although I would want to understand where the error is if possible, I don’t think we are meant modify it. I sent you a few screenshots of my code and the input with the error as well. Let me know how I can move forward. Thanks again!

Hello Gard, I had the same problem. After “debugging” the execution, it turned out that in function compute_loss, I set the loss value as follows:

loss = MSE(y_targets, q_values).numpy()

because that is what I saw from Tensorflow official documentation. The problem is that later on, rather than a numpy object, the main algorithm needs to work with Tensors objects. Removing .numpy() worked form me, as now, loss is of type Tensor rather than numpy.

Maybe something similar happened to you,
hope you can manage to solve it!

Hello @jbg73,

Thank you for sharing your experience with us!