Created
August 18, 2019 05:51
-
-
Save walsvid/e5995b575d2eb982f679c15063f3c1fa to your computer and use it in GitHub Desktop.
tensorflow save的时候改名
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def rename(self, sess=None, ckpt_path=None, step=None): | |
# if not sess: | |
# raise AttributeError('TensorFlow session not provided.') | |
# print(self.vars) | |
new_vars = {} | |
for k,v in self.vars.items(): | |
new_vars[k.replace('meshnet','meshnetmvp2m')] = v | |
saver = tf.train.Saver(new_vars, max_to_keep=0) | |
save_path = saver.save(sess, os.path.join(ckpt_path, 'new', '{}.ckpt'.format(self.name)), global_step=step) | |
print('Model saved in file: {}, epoch {}'.format(save_path, step)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment