Optimization loop failed: Cancelled: Operation was cancelled

I’m having similar problem, with this Error:
“W tensorflow/core/data/root_dataset.cc:266] Optimization loop failed: CANCELLED: Operation was cancelled”

My batch is not larger than the whole dataset
The exact code are taken from a YouTube tutorial:

you can get the code to reproduce the error from here (Although in the Video tutorial he didn’t get that error):

So what is the problem is it because i’m using a newer version of Tensorflow ?

Note:
i’m using Python 3.9 | Tensorflow 2.10.0 | Tensorflow-gpu 2.10.0 | keras 2.10.0 | Window 10