Tob*_*ias 5 python machine-learning deep-learning keras tensorflow
我正在用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
Run Code Online (Sandbox Code Playgroud)
我的模型看起来像这样:
_________________________________________________________________
Layer (type) Output Shape Param #
=================================================================
masking_1 (Masking) (None, None, 3) 0
_________________________________________________________________
simple_rnn_1 (SimpleRNN) (None, None, 50) 2700
_________________________________________________________________
time_distributed_1 (TimeDist (None, None, 11) 561
_________________________________________________________________
activation_1 (Activation) (None, None, 11) 0
=================================================================
Total params: 3,261
Trainable params: 3,261
Run Code Online (Sandbox Code Playgroud)
编辑:当我将后端切换到theano时,相同的网络在GPU上运行得更快,我认为GPU上的"tile"在张量流中存在问题
小智 0
如果您使用 ReLU,请尝试使用Tanh损失。
我使用 ReLU 构建 100 个 epoch 的 LSTM-DNN 模型。每个 Epoch 从大约 14 秒变为 2 秒
希望这能解决你的问题 - 我也在 GPU 上运行,所以不幸的是它可能只是你的处理器 - 如果你遇到瓶颈,请使用 google Colab - 你可以免费使用 GPU
| 归档时间: |
|
| 查看次数: |
1518 次 |
| 最近记录: |