Save & restore

https://medium.com/@jsflo.dev/saving-and-loading-a-tensorflow-model-using-the-savedmodel-api-17645576527

assets/
assets.extra/
variables/ #  learned weights
    variables.data-*****-of-*****
    variables.index
saved_model.pb # graph structure

tf.train.Saver

# construct graph!
...
# add save/restore ops
saver = tf.train.Saver()
...
# save after training
save_path = saver.save(sess, "/tmp/model.ckpt")

you need to reconstruct graph to restore.

Use case = splitting training into separate sessions and want a quick way to resume training.

tf.saved_model.simple_save

simple_save(sess,
            export_dir,
            inputs={"myInput": x},
            outputs={"myOutput": y})

Last updated

Was this helpful?