本文介绍了Keras-ImportError:无法导入名称"CuDNNLSTM"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用CuDNNLSTM Keras细胞来提高循环神经网络的训练速度(doc 此处).

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

当我跑步时:

from keras.layers import Bidirectional, CuDNNLSTM

我收到此错误:

我的配置是Keras 2.0.8,python 3.5,tensorflow-gpu 1.4.0(均由Anaconda管理),并且我同时安装了CUDA 8.0和cudnn 6.0,对于tensorflow的nvidia依赖关系应该没问题(此处).我的代码设置使Keras有效地使用了tensorflow后端,除以CuDNN *开头的层以外的其他所有层都可以正常工作.

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 ?

推荐答案

事实证明keras 2.0.8没有较新版本中提供的用于此类图层的代码.

It turns out keras 2.0.8 doesn't have the code for these kind of layers that came in more recent versions.

我用pip升级到最新版本:

I used pip to upgrade to the lastest version:

pip install --upgrade keras

现在一切正常.

这篇关于Keras-ImportError:无法导入名称"CuDNNLSTM"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-04 08:43
查看更多