我正在研究 mnist example在 tensorflow 中。
我对模块 FLAGS 感到困惑
# Basic model parameters as external flags.
FLAGS = None
在“run_training”函数中:
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)
这里使用“FLAGS.batch_size”和“FLAGS.num_epochs”的目的是什么?我可以用 128 之类的常数替换它吗?
我在 this site 中找到了类似的答案但我还是不明白。
最佳答案
标志通常用于解析命令行参数和保存输入参数。您可以将它们替换为常量,但最好在标志的帮助下组织输入参数。
关于python - tensorflow 中 "FLAGS"的用途是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45162446/