Failed to initialize GPU device #0: unknown error

Each time I run the fit method for keras model, I got “…loss: nan - val_loss: nan”

System configuration:
windows 10
tensorflow 1.13.1
Keras 2.2.4

GPU settings:
Type: NVIDIA GeForce 940MX
Driver version: 25.21.14.1881
cuda toolkit file: cuda_10.0.130_411.31_win10.exe
CUPTI file: cupti-win64-cuda10-1.0.7.zip
cuDNN SDK file: cudnn-9.0-windows10-x64-v7.1.zip

Error details:

2019-04-23 11:38:09.174521: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1433] Found device 0 with properties:
name: GeForce 940MX major: 5 minor: 0 memoryClockRate(GHz): 1.2415
pciBusID: 0000:01:00.0
totalMemory: 2.00GiB freeMemory: 1.65GiB
2019-04-23 11:38:09.188531: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-04-23 11:38:10.493516: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-23 11:38:10.499435: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0
2019-04-23 11:38:10.502198: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N
2019-04-23 11:38:10.505805: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 1394 MB memory) -> physical GPU (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0, compute capability: 5.0)
2019-04-23 11:38:10.519940: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1512] Adding visible gpu devices: 0
2019-04-23 11:38:10.523796: I tensorflow/core/common_runtime/gpu/gpu_device.cc:984] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-04-23 11:38:10.529449: I tensorflow/core/common_runtime/gpu/gpu_device.cc:990]      0
2019-04-23 11:38:10.535046: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1003] 0:   N
2019-04-23 11:38:10.538570: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/device:GPU:0 with 1394 MB memory) -> physical GPU (device: 0, name: GeForce 940MX, pci bus id: 0000:01:00.0, compute capability: 5.0)
[I 11:40:01.542 NotebookApp] Saving file at /Desktop/Python-folder/Kaggle-SAE-SGD.ipynb
2019-04-23 12:03:04.266249: E tensorflow/core/grappler/clusters/utils.cc:83] Failed to get device properties, error code: 30
Failed to initialize GPU device #0: unknown error
2019-04-23 12:03:05.916338: I tensorflow/stream_executor/dso_loader.cc:152] successfully opened CUDA library cublas64_100.dll locally
[I 12:04:01.545 NotebookApp] Saving file at /Desktop/Python-folder/Kaggle-SAE-SGD.ipynb
[I 12:08:01.518 NotebookApp] Saving file at /Desktop/Python-folder/Kaggle-SAE-SGD.ipynb