From 07716af693d2f10f0071dfff1132f720b1d167ce Mon Sep 17 00:00:00 2001 From: tomrink <rink@ssec.wisc.edu> Date: Mon, 25 Oct 2021 15:07:43 -0500 Subject: [PATCH] more work on saving/restoring ewa trainable variables... --- modules/deeplearning/icing_cnn.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/deeplearning/icing_cnn.py b/modules/deeplearning/icing_cnn.py index 606f881e..0cb69040 100644 --- a/modules/deeplearning/icing_cnn.py +++ b/modules/deeplearning/icing_cnn.py @@ -915,13 +915,17 @@ class IcingIntensityNN: self.build_dnn(flat) self.model = tf.keras.Model(self.inputs, self.logits) - def restore(self, ckpt_dir): + def restore(self, ckpt_dir, varsdir=None): ckpt = tf.train.Checkpoint(step=tf.Variable(1), model=self.model) ckpt_manager = tf.train.CheckpointManager(ckpt, ckpt_dir, max_to_keep=3) ckpt.restore(ckpt_manager.latest_checkpoint) + if TRACK_MOVING_AVERAGE: + savr = tf.compat.v1.train.Saver(self.model.trainable_variables) + savr.restore(None, varsdir) + self.test_loss.reset_states() self.test_accuracy.reset_states() -- GitLab