Skip to content

Instantly share code, notes, and snippets.

@wookayin
Last active March 12, 2018 13:33
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wookayin/6ca93b8309f05055c6a3 to your computer and use it in GitHub Desktop.
Save wookayin/6ca93b8309f05055c6a3 to your computer and use it in GitHub Desktop.
Reset tensorflow tf.app.flags, in ipython notebook
# use the following snippet in your ipython notebook shell
import argparse
import tensorflow as tf
tf.app.flags.FLAGS = tf.python.platform.flags._FlagValues()
tf.app.flags._global_parser = argparse.ArgumentParser()
@ialhashim
Copy link

This worked for me

import argparse as _argparse

tf.app.flags._global_parser = _argparse.ArgumentParser()

@jbachh
Copy link

jbachh commented Mar 12, 2018

So where should this call be placed? Doesn't work for me before, after or between initialization and definition of flags.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment