Skip to content

Instantly share code, notes, and snippets.

@Mistobaan
Created June 6, 2020 05:40
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mistobaan/786496ca8b1b75c2580e1915d37ef7eb to your computer and use it in GitHub Desktop.
Save Mistobaan/786496ca8b1b75c2580e1915d37ef7eb to your computer and use it in GitHub Desktop.
How to Compute Virtual Epochs in Tensorflow
NUM_TRAINING_EXAMPLES = 1000 * 1000
STOP_POINT = 14.3
TOTAL_TRAINING_EXAMPLES = int(STOP_POINT * NUM_TRAINING_EXAMPLES)
BATCH_SIZE = 100
NUM_CHECKPOINTS = 15
steps_per_epoch = (TOTAL_TRAINING_EXAMPLES //
(BATCH_SIZE*NUM_CHECKPOINTS))
cp_callback = tf.keras.callbacks.ModelCheckpoint(...)
history = model.fit(trainds,
validation_data=evalds,
epochs=NUM_CHECKPOINTS,
steps_per_epoch=steps_per_epoch,
batch_size=BATCH_SIZE,
callbacks=[cp_callback])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment