TensorFlow Model - 2.0 English

Vitis AI Optimizer User Guide (UG1333)

Document ID
UG1333
Release Date
2022-01-20
Version
2.0 English

TensorFlow saves variables in binary checkpoint files that map variable names to tensor values. vai_p_tensorflow takes a checkpoint file as input to load trained weights. tf.train.Saver provides methods to specify paths for the checkpoint files to write to or read from.

The following code snippet calls the tf.train.Saver.save method to save variables to checkpoint files:

with tf.Session() as sess:
# your graph building codes here
# ……
sess.run(train_op)

# Save the variables to disk.
save_path = saver.save(sess, "/tmp/model.ckpt")
print("Model saved in path: %s" % save_path)

The saved checkpoint files look like this:

model.ckpt.data-00000-of-00001
model.ckpt.index
model.ckpt.meta