Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Keras - ImportError: cannot import name 'CuDNNLSTM'

I am trying to use the CuDNNLSTM Keras cell to improve training speed for a recurrent neural network (doc here).

When I run:

from keras.layers import Bidirectional, CuDNNLSTM

I get this error:

ImportError: cannot import name 'CuDNNLSTM'

My configuration is Keras 2.0.8, python 3.5, tensorflow-gpu 1.4.0 (all managed by Anaconda) and I have both CUDA 8.0 and cudnn 6.0 installed that should be OK with the nvidia dependencies of tensorflow (here). My code setup makes Keras effectively use tensorflow backend, and every layer except the ones starting with CuDNN* work fine.

Anyone has an idea about the source of this import error ?

like image 715
Marvin Lerousseau Avatar asked Dec 17 '17 17:12

Marvin Lerousseau


1 Answers

And for Tensorflow-2: You can just use LSTM with no activation function and it will automatically use the CuDNN version

like image 75
Archy Will He 何魏奇 Avatar answered Sep 29 '22 17:09

Archy Will He 何魏奇