2016-11-12 79 views
17

Tensorflow是給我這個懸而未決的錯誤:Tensorflow AttributeError的: 'NoneType' 對象有沒有屬性 'TF_DeleteStatus'

Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7f68d14b6668>> 
Traceback (most recent call last): 
    File "/opt/anaconda3/lib/python3.5/site-packages/tensorflow/python/client/session.py", line 532, in __del__ 
AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus' 

錯誤已被討論here。問題在於它沒有始終如一地出現。但是,它頻繁出現在我的終端中。有沒有人設法解決它。謝謝。

+0

感謝您對github發表評論。一個修復即將到來。 – drpng

回答

15

您可以在代碼的末尾運行import gc; gc.collect()

+1

我剛剛嘗試了這個基於http://machinelearningmastery.com/tutorial-first-neural-network-python-keras/的簡單Keras示例。唉,我仍然得到錯誤。 –

5

您需要刪除Tensorflow會話以避免該消息。最簡單的可能是使用with聲明:從GitHub

from keras import backend as K 

def main(): 
    with K.get_session(): 
     train() 
     classify() 
+0

這不適合我 – gessulat

2

答案張貼在這裏,以節省時間:

from keras import backend as K 

# ... code 
K.clear_session() 

我加入了K.clear_session()在我的代碼model.load_weights調用前右和工作。

相關問題