This does not seem like Hardware accelerator - GPU/TPU error as I tried replicating the same using Google Colab by selecting the available - CPU/GPU and TPU and did not notice any issue. Please find the replicated gist for the same.
Please try again by installing the latest Tensorflow 2.18
and Keras 3.7
version and let us know if the issues still persists. Thank you.