只需将Cuda与Anaconda一起安装即可。尝试运行安装之前可以使用的相同模型时,我在lstm层的第一次添加上得到了错误消息:TypeError:(“关键字参数不被理解:”,“激活”)。
我的代码如下:
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'))
答案 0 :(得分:2)
支持此操作是不可行的,因为基础的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