CuDNNLSTM:UnknownError:找不到dnn实现 [英] CuDNNLSTM: UnknownError: Fail to find the dnn implementation

查看:480
本文介绍了CuDNNLSTM:UnknownError:找不到dnn实现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经成功地将LSTM作为第一层运行了该模型.但是出于好奇,我将LSTM替换为CuDNNLSTM. 但是在model.fit之后,它回复了以下错误消息:

I have run the model with LSTM as the first layer successfully. But out of curiosity, I replace LSTM with CuDNNLSTM. But after model.fit, it replied the following error message:

UnknownError: Fail to find the dnn implementation.
    [[{{node cu_dnnlstm_5/CudnnRNN}} = CudnnRNN[T=DT_FLOAT, _class=["loc:@training_2/Adam/gradients/cu_dnnlstm_5/CudnnRNN_grad/CudnnRNNBackprop"], direction="unidirectional", dropout=0, input_mode="linear_input", is_training=true, rnn_mode="lstm", seed=87654321, seed2=0, _device="/job:localhost/replica:0/task:0/device:GPU:0"](cu_dnnlstm_5/transpose, cu_dnnlstm_5/ExpandDims_1, cu_dnnlstm_5/ExpandDims_1, cu_dnnlstm_5/concat_1)]]
    [[{{node metrics_3/mean_squared_error/Mean_1/_1877}} = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device_incarnation=1, tensor_name="edge_4852_metrics_3/mean_squared_error/Mean_1", tensor_type=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:CPU:0"]()]]

我已经在讨论中尝试过TestCudnnLSTM()并通过了测试成功:

I have tried TestCudnnLSTM() on this discussion and pass the test successfully:


Keras version: 2.2.4
Tensorflow version: 1.12.0
Creating Model
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
cu_dnnlstm_1 (CuDNNLSTM)     (None, 1000, 1)           16        
=================================================================
Total params: 16
Trainable params: 16
Non-trainable params: 0
_________________________________________________________________
None
Model compiled

似乎在模型拟合期间出现了问题.但是我不知道到底是什么问题?

It seems that the problem appears during model fitting. But I don't know exactly what is the problem?

推荐答案

对于TensorFlow v2,一种解决方案是-

For TensorFlow v2, one solution would be -

import tensorflow as tf
physical_devices = tf.config.list_physical_devices('GPU')
tf.config.experimental.set_memory_growth(physical_devices[0], enable=True)

然后您也可以使用keras模型-

Then you can use keras model too -

from tensorflow.keras.models import Model

文档

此解决方案对我有用,它仅支持一个GPU的内存增长.

This solution worked for me, it enables memory growth for only one GPU.

这篇关于CuDNNLSTM:UnknownError:找不到dnn实现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆