Problem with Keras - Cannot cast array

Yes, it was just a try for understanding how it worked, but that’s fine.

Could you please also help me to understand this?

Thank you