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("")
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With