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.
You can run import gc; gc.collect()
import gc; gc.collect()
in the end of your code.
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()
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.
write code in your tensorflow keras model...
from keras import backend as K
.
.
.
.
.
model.load_weights("modelname")
K.clear_session()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.