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
# Adapted from https://gist.github.com/batzner/7c24802dd9c5e15870b4b56e22135c96 | |
import getopt | |
import sys | |
import tensorflow as tf | |
usage_str = ('python tensorflow_rename_variables.py ' | |
'--checkpoint_dir=path/to/dir/ --replace_from=substr ' | |
'--replace_to=substr --add_prefix=abc --dry_run') | |
find_usage_str = ('python tensorflow_rename_variables.py ' |
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
import sys, getopt | |
import tensorflow as tf | |
usage_str = 'python tensorflow_rename_variables.py --checkpoint_dir=path/to/dir/ ' \ | |
'--replace_from=substr --replace_to=substr --add_prefix=abc --dry_run' | |
def rename(checkpoint_dir, replace_from, replace_to, add_prefix, dry_run): | |
checkpoint = tf.train.get_checkpoint_state(checkpoint_dir) |