ImportError: cannot import name 'CuDNNLSTM' from 'tensorflow.keras.layers'

I am getting this error when I try to run my model.
I checked the version compatibility of all the components and everything seems to be right.
TensorFlow - 2.0.0
Keras - 2.3.0
CUDA ToolKit - v10.0
CuDNN - v7.6.4

Please help me with this

Traceback (most recent call last):
File “model.py”, line 3, in
from tensorflow.keras.layers import Dense, Dropout, CuDNNLSTM
ImportError: cannot import name ‘CuDNNLSTM’ from ‘tensorflow.keras.layers’ (C:\Users\CaptainSlow\Anaconda3\envs\venv\lib\site-packages\tensorflow_core\python\keras\api_v2\keras\layers_init_.py)

I have the same error today, ever slightly different Keras version (2.3.1)

1 Like

The error was because from TensorFlow 2 you do not need to specify CuDNNLSTM. You can just use LSTM with no activation function and it will automatically use the CuDNN version. You do have to install CuDNN first.

2 Likes

thanks!