【问题标题】:When Using Cuda: TypeError: ('Keyword argument not understood:', 'activation')使用 Cuda 时:TypeError:('关键字参数不理解:','激活')
【发布时间】:2020-02-18 07:46:46
【问题描述】:

刚刚用 Anaconda 安装了 Cuda。当尝试运行安装前工作的相同模型时,我在第一次添加 lstm 层时收到错误消息:TypeError: ('Keyword argument not understand:', 'activation')。

我的代码如下所示:

from tensorflow.keras.layers import Dense, Activation, Embedding, LSTM, Dropout, CuDNNLSTM
from tensorflow.keras.models import Sequential
import tensorflow as tf
from sklearn.metrics import confusion_matrix
import matplotlib.pyplot as plt
import pylab as pl
import seaborn as sns


model = Sequential()
model.add(CuDNNLSTM(128, input_shape=(800,1), activation='tanh', return_sequences=True))
model.add(Dropout(0.2))
model.add(CuDNNLSTM(128, activation='tanh'))
model.add(Dropout(0.2))
model.add(Dense(32, activation='tanh'))
model.add(Dropout(0.2))
model.add(Dense(1, activation='sigmoid'))

【问题讨论】:

    标签: python tensorflow


    【解决方案1】:

    支持这个是不可行的,因为底层的 cudnn API 不允许我们为 LSTMS 选择激活函数:https://docs.nvidia.com/deeplearning/sdk/cudnn-developer-guide/index.html#cudnnRNNMode_t

    请在此处查看 GitHub 问题:https://github.com/tensorflow/tensorflow/issues/24375

    相同的未解决问题在这里结束: https://github.com/keras-team/keras/issues/8510

    【讨论】:

      猜你喜欢
      • 2020-08-12
      • 2020-12-09
      • 1970-01-01
      • 2020-12-09
      • 2021-08-17
      • 2018-12-29
      • 2021-01-28
      • 1970-01-01
      相关资源
      最近更新 更多