22

Tensorflow is giving me this unresolved error:

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'

The error has been discussed here. The problem is it is not showing up consistently. However, it is showing up in my terminal frequently. Has anybody managed to get around it.Thanks.

1
  • Thanks for commenting on github. A fix is coming.
    – drpng
    Nov 12, 2016 at 16:03

4 Answers 4

16

You can run import gc; gc.collect() in the end of your code.

1
8

Answer from Github posted here to save time:

from keras import backend as K

# ... code
K.clear_session()

I added the K.clear_session() right before the model.load_weights call in my code and that worked.

7

You need to delete the Tensorflow session to avoid that message. The simplest probably is to use a with statement:

from keras import backend as K

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

write code in your tensorflow keras model...

from keras import backend as K
.
.
.
.
.
model.load_weights("modelname")
K.clear_session()

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.