I am studying the mnist example in tensorflow.
I am confused with the module FLAGS
# Basic model parameters as external flags.
FLAGS = None
In the "run_training" funcition :
def run_training():
"""Train MNIST for a number of steps."""
# Tell TensorFlow that the model will be built into the default Graph.
with tf.Graph().as_default():
# Input images and labels.
images, labels = inputs(train=True, batch_size=FLAGS.batch_size,
num_epochs=FLAGS.num_epochs)
What's the purpose of using "FLAGS.batch_size" and "FLAGS.num_epochs" here? Can I just replace it with a constant number like 128?
I found a similar answer in this site but I still can't understand.
The flags are generally used to parse command line arguments and hold input parameters. You could replace them with constant numbers, but it is good practice to organise your input parameters with the help of flags.
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