Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Python TensorFlow - what is tf.flags.FLAGS?

Tags:

What is the purpose of parsing flags in TensorFlow? What is tf.flags.FLAGS? & what does this code statement do?

FLAGS = tf.flags.FLAGS
FLAGS._parse_flags()
print("\nParameters:")
for attr, value in sorted(FLAGS.__flags.items()):
    print("{}={}".format(attr.upper(), value))
print("")
like image 200
sofbi Avatar asked Jun 22 '18 14:06

sofbi


1 Answers

In Tensorflow the flags are basically run parameters for your model. Later in the code you will probably see a tf.app.run() which will utilize these flags. What this code does is grab all the currently existing flags, and print them all out in this format:

Parameters:
learning_rate=0.01
max_steps=2000
hidden1=128
hidden2=32
batch_size=100

These parameters are just examples that I found online, and will vary from model to model. Hope this helps.

like image 183
mmghu Avatar answered Sep 19 '22 11:09

mmghu