model = Sequential([
LSTM(units=50,return_sequences=True,input_shape=(lookback,1)),
Dense(units=1)
])
model.compile(loss=keras.losses.MSE,optimizer=keras.optimizers.Adam(),metrics=['accuracy'])
model.fit(trainx,trainy,validation_data=(testx,testy),epochs=20,batch_size=1)
model.compile 抛出错误
InvalidArgumentError: Graph execution error:
No OpKernel was registered to support Op 'CudnnRNN' used by {{node CudnnRNN}} with these attrs: [seed=0, dropout=0, T=DT_FLOAT, input_mode="linear_input", direction="unidirectional", rnn_mode="lstm", seed2=0, is_training=true]
Registered devices: [CPU, GPU]
...
Registered kernels:
<no registered kernels>
[[CudnnRNN]]
[[sequential_2/lstm_6/PartitionedCall]] [Op:__inference_train_function_15994]
我有AMD GPU和tensorflow-directml
print(tf. __version__)
====>2.10.0
print(tf.config.list_physical_devices('GPU'))
====>[PhysicalDevice(name='/physical_device:GPU:0', device_type='GPU')]
注意上面的代码运行完美 如果我在CPU上运行它
with tf.device('/CPU:0'):
model.fit(trainx,trainy,validation_data=(testx,testy),epochs=2,batch_size=1,verbose=1)
有没有办法在AMD GPU上运行它
同样的错误: tensorflow.python.framework.errors_impl.InvalidArgumentError:图形执行错误:
没有注册 OpKernel 来支持 {{node CudnnRNN}} 使用的 Op 'CudnnRNN',其属性如下:[seed=0, dropout=0, T=DT_FLOAT, input_mode="linear_input", Direction="unidirection", rnn_mode= “lstm”,seed2=0,is_training=true] 注册设备:[CPU、GPU] 注册内核:
[[CudnnRNN]]
有人可以帮忙吗?