Tensorflow saver seems to overwrite existing saved variable files

前端 未结 1 754
半阙折子戏
半阙折子戏 2021-01-03 10:31

I am writing neural network code in tensorflow. I made it to save variables in every 1000 epoch. So, I expect to save variables of 1001th epoch, 2001th epoch, 3001th epoch .

相关标签:
1条回答
  • 2021-01-03 11:29

    tf.train.Saver has a max_to_keep argument in its constructor that keeps only the latest models saved. And this max_to_keep argument, somewhat suprisingly, has a default value of 5. So by default, you will only have the latest 5 models.

    To keep all models, set this variable to None:

    saver = tf.train.Saver(max_to_keep=None)
    
    0 讨论(0)
提交回复
热议问题