Skip to content

Instantly share code, notes, and snippets.

View flymin's full-sized avatar
🐼
Working hard

Gao, Ruiyuan flymin

🐼
Working hard
View GitHub Profile
@flymin
flymin / tensorflow_rename_variables.py
Last active June 16, 2020 01:22 — forked from batzner/tensorflow_rename_variables.py
[ckpt rename] Small python script to rename variables in a TensorFlow checkpoint; add output option and only display changing variables #Tensorflow
import sys, getopt
import os
import pdb
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 ' \
'--output_dir=dir/to/output'