在GPU上运行Keras(Tensorflow后端)时出现OOM错误。同一脚本在CP​​U上运行完成

时间:2018-09-13 15:41:30

标签: python tensorflow keras gpu

在GPU上运行keras脚本时出现以下错误:

tensorflow.python.framework.errors_impl.ResourceExhaustedError: OOM when allocating tensor with shape[1032192,500] and type float on /job:localhost/replica:0/task:0/device:GPU:0 by allocator GPU_0_bfc
     [[Node: training/Adam/mul_63 = Mul[T=DT_FLOAT, _device="/job:localhost/replica:0/task:0/device:GPU:0"](Adam/beta_2/read, training/Adam/Variable_28/read)]]

此脚本在CP​​U上运行良好,尽管运行速度非常慢。

我尝试将批量大小减小到1,但问题仍然存在。我也尝试过重新缩放图像。

还有另一种减少使用内存的方法吗?有人碰到这个吗?

0 个答案:

没有答案
相关问题