简体   繁体   English

Tensorflow AttributeError:'NoneType'对象没有属性'TF_DeleteStatus'

[英]Tensorflow AttributeError: 'NoneType' object has no attribute 'TF_DeleteStatus'

Tensorflow is giving me this unresolved error: Tensorflow给了我这个未解决的错误:

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() import gc; gc.collect() in the end of your code. 代码末尾的import gc; gc.collect()

You need to delete the Tensorflow session to avoid that message. 您需要删除Tensorflow会话以避免该消息。 The simplest probably is to use a with statement: 最简单的可能是使用with语句:

from keras import backend as K

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

Answer from Github posted here to save time: Github的回答发布在这里以节省时间:

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. 我在我的代码中调用了model.load_weights之前添加了K.clear_session() ,这很有效。

write code in your tensorflow keras model... 在tensorflow keras模型中编写代码......

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Tensorflow AttributeError:&#39;NoneType&#39;对象没有属性&#39;keys&#39; - Tensorflow AttributeError: 'NoneType' object has no attribute 'keys' AttributeError: &#39;NoneType&#39; 对象没有属性 &#39;name&#39;(与不同的 tensorflow 版本有关) - AttributeError: 'NoneType' object has no attribute 'name' ( related to different tensorflow versions ) Tensorflow:AttributeError:&#39;NoneType&#39;对象没有属性&#39;original_name_scope&#39; - Tensorflow: AttributeError: 'NoneType' object has no attribute 'original_name_scope' AttributeError: &#39;NoneType&#39; 对象没有属性 - AttributeError: 'NoneType' object has no attribute AttributeError:“ NoneType”对象没有属性“ a” - AttributeError: 'NoneType' object has no attribute 'a' AttributeError:&#39;NoneType&#39;对象没有属性&#39;mention&#39; - AttributeError: 'NoneType' object has no attribute 'mention' Python,AttributeError:“ NoneType”对象没有属性“ show” - Python, AttributeError: 'NoneType' object has no attribute 'show' AttributeError:&#39;NoneType&#39;对象没有属性&#39;_root&#39; - AttributeError: 'NoneType' object has no attribute '_root' AttributeError: &#39;NoneType&#39; 对象没有属性 &#39;setText&#39; - AttributeError: 'NoneType' object has no attribute 'setText' Python:AttributeError:&#39;NoneType&#39;对象没有属性&#39;findNext&#39; - Python: AttributeError: 'NoneType' object has no attribute 'findNext'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM