Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/358.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用Cuda时:TypeError:(“关键字参数未理解:”,“激活”)_Python_Tensorflow - Fatal编程技术网

Python 使用Cuda时:TypeError:(“关键字参数未理解:”,“激活”)

Python 使用Cuda时:TypeError:(“关键字参数未理解:”,“激活”),python,tensorflow,Python,Tensorflow,刚刚安装了Cuda和Anaconda。当尝试运行安装前运行的同一模型时,我在第一次添加lstm层时收到错误消息:TypeError:“关键字参数未理解:”,“activation” 我的代码如下所示: from tensorflow.keras.layers import Dense, Activation, Embedding, LSTM, Dropout, CuDNNLSTM from tensorflow.keras.models import Sequential import tens

刚刚安装了Cuda和Anaconda。当尝试运行安装前运行的同一模型时,我在第一次添加lstm层时收到错误消息:TypeError:“关键字参数未理解:”,“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'))

支持这一点是不可行的,因为基础cudnn API不允许我们为LSTM选择激活函数:

请在此处检查GitHub问题:

同样的公开发行在这里: