【时间】2018.12.21
【题目】运行Tesorflow代码时错TypeError: 'NoneType' object is not callable的解决办法
【出现的错误】
Exception ignored in: <bound method BaseSession.__del__ of <tensorflow.python.client.session.Session object at 0x7f88aa233320>>
Traceback (most recent call last):
File "/usr/local/lib/python3.5/dist-packages/tensorflow/python/client/session.py", line 696, in __del__
TypeError: 'NoneType' object is not callable
【解决办法】这是在调用函数时没有 return造成的,只要在函数中加入return即可解决,所以哪怕你的函数没有返回参数,最好也在函数后面加上 return.
【其他解决方法(未试过)】参考tensorflow代码运行的最后抛出异常:TypeError: 'NoneType' object is not callable
在程序中加入:
from keras import backend as K
K.clear_session()