Keras reset layer numbers

后端 未结 4 1447
灰色年华
灰色年华 2020-12-31 21:21

Keras assigns incrementing ID numbers to layers of the same type, e.g. max_pooling1d_7, max_pooling1d_8, max_pooling1d_9,etc. Each ite

相关标签:
4条回答
  • 2020-12-31 22:13

    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.

    0 讨论(0)
  • 2020-12-31 22:18

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

    from keras import backend as K
    K.clear_session()
    
    0 讨论(0)
  • 2020-12-31 22:26

    Add

    tf.keras.backend.clear_session()
    

    as in https://www.tensorflow.org/api_docs/python/tf/keras/backend/clear_session

    0 讨论(0)
  • 2020-12-31 22:28

    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.

    0 讨论(0)
提交回复
热议问题