Last active
December 15, 2016 09:21
-
-
Save galeone/790df5dc0039a04f878656862997b8fb to your computer and use it in GitHub Desktop.
Replace in every python file the old Tensorflow API with the new syntax
This file contains hidden or 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
#!/usr/bin/env bash | |
find . -name '*.py' -exec grep "tf.image_summary" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.image_summary/tf.summary.image/g' | |
find . -name '*.py' -exec grep "tf.audio_summary" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.audio_summary/tf.summary.audio/g' | |
find . -name '*.py' -exec grep "tf.histogram_summary" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.histogram_summary/tf.summary.histogram/g' | |
find . -name '*.py' -exec grep "max_images" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/max_images/max_outputs/g' | |
find . -name '*.py' -exec grep "tf.merge_summary" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.merge_summary/tf.summary.merge/g' | |
find . -name '*.py' -exec grep "tf.scalar_summary" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.scalar_summary/tf.summary.scalar/g' | |
find . -name '*.py' -exec grep "tf.initialize_all_variables" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.initialize_all_variables/tf.global_variables_initializer/g' | |
find . -name '*.py' -exec grep "tf.SummaryWriter" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.SummaryWriter/tf.summary.FileWriter/g' | |
find . -name '*.py' -exec grep "tf.train.SummaryWriter" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.train\.SummaryWriter/tf.summary.FileWriter/g' | |
find . -name '*.py' -exec grep "tf.merge_all_summaries" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.merge_all_summaries/tf.summary.merge_all/g' | |
find . -name '*.py' -exec grep "tf\.image\.per_image_whitening" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.image\.per_image_whitening/tf.image.per_image_standardization/g' | |
find . -name '*.py' -exec grep "tf.pack" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.pack/tf.stack/g' | |
find . -name '*.py' -exec grep "tf.concat" {} -H \; | cut -d':' -f1 | xargs -l sed -i 's/tf\.concat/tf.concat_v2/g' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment