0

I've trained a model on some data (just a simple classification task). After, I wish to use this same model to run some predictions via a separate function make_prediction().

So currently my main file is simply something like :

agent.train(data)

agent.make_predictions(new_data)

and tf.global_variables_initializer() with tf.Session() as sess: sess.run(init)

I don't initialize the variables in my second function so that session is different to the previous but it is surprising to me that I can't simply reopen a previous session. Do I need to checkpoint the model after training and then reload it each time?

Thanks a lot

tryingtolearn
  • 2,528
  • 7
  • 26
  • 45
  • Can you paste more of your code, and can you be more concrete? What are you trying to achieve? What exactly is the "initialization error" you refer to in the title of this question? – Akshay Agrawal Feb 01 '18 at 17:30
  • Apologies for the delay. The solution was to checkpoint my model after each training session and then load the corresponding weights if I wanted to make predictions. A bit inconvenient but rolling with what works. – tryingtolearn Feb 05 '18 at 16:38

0 Answers0