问题描述
我是tensorflow的新手,正在尝试对其进行设置.
I am new to tensorflow and trying to set it up.
当我尝试使用CuDNNGRU训练模型时,似乎可以正确加载,然后出现错误:
When I try to train a model using CuDNNGRU it seems to load correctly and then gives an error :
我确实在tensorflow/contrib中看到了Cudnn_rnn目录,这是值得的.
I do see a Cudnn_rnn directory in tensorflow/contrib for what that is worth.
我有python 3.6和VS2013.
I have python 3.6 and VS2013.
我尝试了以下操作,但仍然出现错误:
I have tried the following, but still getting an error:
- 两个Cuda 8/9
- 卸载/重新安装tensorflow/Theano/Keras/TensorFlow
老实说,设置看起来是如此复杂和敏感,我可能已经搞砸了.
Honestly the setup seems so convoluted and touchy, I may have screwed something up.
我想念一个待办事项吗?有一些手动修复的方法吗?谢谢!
Am I missing a to-do? Some way to manually fix? Thanks!
我要复制的示例代码:
def get_model(embedding, sequence_length, dropout_rate, recurrent, dense_size):
input_layer = Input(shape=(sequence_length,))
embedding_layer = Embedding(embedding.shape[0], embedding.shape[1],
weights=[embedding], trainable=False)(input_layer)
x = Bidirectional(CuDNNGRU(recurrent, return_sequences=True))(embedding_layer)
x = Dropout(dropout_rate)(x)
x = Bidirectional(CuDNNGRU(recurrent, return_sequences=False))(x)
x = Dense(dense_size, activation="relu")(x)
推荐答案
我通过以下操作解决了此问题:
I fixed this by doing :
pip install tensorflow --ignore-installed --upgrade
pip install tensorflow --ignore-installed --upgrade
然后
从tensorflow.python.client导入device_lib打印(device_lib.list_local_devices())
from tensorflow.python.client import device_lib print(device_lib.list_local_devices())
这篇关于Tensorflow-操作类型未注册'CudnnRNN'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!