使用LSTM网络的GPU上的Keras速度较慢

2024-09-28 22:09:33 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在用keras训练我的模特。当我比较GPU和CPU的性能时。CPU版本比GPU版本快得多

我怎样才能修正下面这些错误?在

我试图将tensorflow强制到GPU,但得到以下错误:

tensorflow.python.framework.errors_impl.InvalidArgumentError: Cannot assign a device to node 'gradients/simple_rnn_1/while/Select_1_grad/Select/f_acc': 
Could not satisfy explicit device specification '/device:GPU:0' because no supported kernel for GPU devices is available. 
Colocation Debug Info: 
Colocation group had the following types and devices: 
Tile: CPU 
StackPush: GPU CPU 
Relu: GPU CPU 
ReluGrad: GPU CPU 
ZerosLike: GPU CPU 
Select: GPU CPU 
StackPop: GPU CPU 
AddN: GPU CPU 
RefEnter: GPU CPU 
Stack: GPU CPU

我的模型是这样的:

^{pr2}$

编辑:当我将后端切换到ano时,同一个网络在GPU上运行得更快,我认为在tensorflow中GPU上的“tile”有问题


Tags: 版本gpudevicetensorflow错误frameworkcpu性能