Keras reset layer numbers

断了今生、忘了曾经 提交于 2019-11-30 16:03:07

The solution, from Attempting to reset tensorflow graph when using keras, failing:

from keras import backend as K
K.clear_session()

Do you use jupyter notebooks? It seems like while you're rebuilding your model your tensorlow session won't restart. Because keras refers to tensorflow graphs per name it's necessary, that the counting continues.

So if you don't want to restartthe session you're fine. However this also means, that the tensorflow session gets bigger and bigger, so restarting the session might be the desired approach. For this restart the complete program/kernel.

Each iteration shouldn't construct a new model. Training should go through in same model. Maybe post your code to see what might goes wrong.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!