# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     language: python
#     name: python3
# ---

import tensorflow as tf

x = tf.Variable(0)

increment_x = tf.assign(x, x + 1)

# +
sess = tf.Session()
initializer = tf.global_variables_initializer()

sess.run(initializer)

saver = tf.train.Saver(max_to_keep=4, keep_checkpoint_every_n_hours=2)

saver.save(sess, './saved_models/my-test-model')
# -

for counter in range(5):    
    
    output = sess.run([increment_x])
    print(output)
    
    saver.save(sess, './saved_models/my-test-model',global_step=counter,write_meta_graph=False)



StarcoderdataJupyterScriptsDedupFiltered