簡體   English   中英

當我的訓練數據很大時,為什么我會在拋出一個 'std::bad_alloc' 實例后調用終止?

[英]Why i am getting "terminate called after throwing an instance of 'std::bad_alloc'' when my training data is large?

我的硬件是 Intel Pentium,8 GB RAM,250 GB 硬盤,沒有 GPU。我能夠用 400 張圖像訓練數據,但是當我將圖像數量增加到 1000 時,它會拋出錯誤

<pre>2019-10-31 21:55:05.844961: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2
terminate called after throwing an instance of &apos;std::bad_alloc&apos;
  what():  std::bad_alloc
Aborted (core dumped)
</pre>

如何解決這個問題?

該錯誤意味着您用完了 memory。

特殊考慮:

在某些情況下,它可能是由 memory 碎片引起的,因為您實際上有足夠的 memory 來為您的任務提供服務,但由於它不連續,因此無法使用。

或者

一個進程被分配了一個大的 memory 部分,其中一些未被占用並且不能被另一個進程使用。

在訓練之間運行tf.reset_default_graph()可能有助於釋放 memory 以防萬一碎片是真正的問題。
keras.clear_session()方法是tf.reset_default_graph() () 的替代方法,它可能有助於在出現碎片的情況下釋放 memory。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM