Skip to content

Instantly share code, notes, and snippets.

@subhankar94
subhankar94 / restore_checkpoint.py
Created June 23, 2017 20:50
restoring from checkpoint for TensorFlow v1.x
# usage: python restore_checkpoint.py model.ckpt-1000
import sys
import tensorflow as tf
ckpt = sys.argv[1]
# soft placement in case using a different system setup
config = tf.ConfigProto(allow_soft_placement=True)
with tf.Session(config=config) as sess:
new_saver = tf.train.import_meta_graph(ckpt + '.meta')
new_saver.restore(sess, ckpt)
@subhankar94
subhankar94 / mcilroy.sh
Created November 24, 2016 22:29
McIlroy's 6 line shell script to print k most frequently occurring words in a file
tr -cs A-Za-z '\n' | # transliterate non-alphabetic chars (-c) to newline ('\n'), squeeze identical adjacent to single instance (-s)
tr A-Z a-z | # transliterate upper case characters to lower case
sort | # sort alphabetically
uniq -c | # collapse identical adjacent lines and add occurence of each line (-c)
sort -rn | # sort in reverse (-r), based on numeric value (-n)
sed ${1}q # pass through stream editor, print first-arg-many words and then quit (q)

Keybase proof

I hereby claim:

  • I am subhankar94 on github.
  • I am subhankar (https://keybase.io/subhankar) on keybase.
  • I have a public key ASDOfIwXn2HsjckIiGAkK4hClcUXC6uosVn9C9gK0uLiZwo

To claim this, I am signing this object: