【问题标题】:Fail to find the dnn implementation for LSTM找不到 LSTM 的 dnn 实现
【发布时间】:2020-02-23 00:16:10
【问题描述】:

我正在尝试使用以下代码运行一个简单的 LSTM 模型

model = tf.keras.models.Sequential()
model.add(tf.keras.layers.LSTM(32,
                                       input_shape=x_train_single.shape[-2:]))
model.add(tf.keras.layers.Dense(1))

model.compile(optimizer=tf.keras.optimizers.RMSprop(), loss='mae')

single_step_history = model.fit(train_data_single, epochs=EPOCHS,
                                        steps_per_epoch=EVALUATION_INTERVAL)

尝试拟合模型时发生错误

tensorflow.python.framework.errors_impl.UnknownError:  [_Derived_]  Fail to find the dnn implementation.
     [[{{node CudnnRNN}}]]
     [[sequential/lstm/StatefulPartitionedCall]] [Op:__inference_distributed_function_3107]

还有一个类似这样的错误

2020-02-22 19:08:06.478567: W tensorflow/core/kernels/data/cache_dataset_ops.cc:820] The calling 
iterator did not fully read the dataset being cached. In order to avoid unexpected truncation of the 
dataset, the partially cached contents of the dataset will be discarded. This can happen if you have 
an input pipeline similar to `dataset.cache().take(k).repeat()`. You should use 
`dataset.take(k).cache().repeat()` instead.

我在这个 question 上尝试了所有方法,但对我不起作用

我的环境是

 tensorflow-gpu 2.0
 CUDA v10
 CuDNN 7.6.5 

解决方案

好的..我发现我没有最新的Nvidia驱动,所以我升级了,并且可以工作

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    即使用户提供了解决方案,也为了社区的利益在这里回答。

    将 Nvidia 驱动程序升级到最新版本已解决此问题。

    您可以从here 手动更新 NVIDIA,方法是选择产品详细信息和操作系统,您必须从他们的网站下载最新的驱动程序。然后,您必须运行安装程序并覆盖旧驱动程序。

    【讨论】:

      【解决方案2】:

      试试下面

      将张量流导入为 tf

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

      【讨论】:

        猜你喜欢
        • 2019-06-25
        • 2019-10-13
        • 2023-03-17
        • 2022-06-14
        • 1970-01-01
        • 1970-01-01
        • 2019-06-29
        • 2017-07-18
        相关资源
        最近更新 更多