python - tensorflow 中 "FLAGS"的用途是什么

标签 python tensorflow deep-learning mnist

我正在研究 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/

相关文章:

python - Scrapy 从任何网站获取所有链接

python - TensorFlow:多次初始化变量

python - 在TensorFlow中,字符串常量的打印总是附有 'b'

python - keras:model.predict和model.predict_proba有什么区别

python - 为什么对于 Keras 中的 Theano 和 Tensorflow 后端,一对图像之间的 L2 距离会得到不同的结果?

python - 属性错误 : 'PyxImporter' object has no attribute 'find_spec' with Pandas/BigQuery

python - Scrapy不抓取https?

python - 将 Python PyCrypto 与 Perl Crypt::CBC 结合使用

tensorflow - 找不到墓碑帐户的帐户(创建笔记本实例)

python - TensorFlow 'module' 对象没有属性 'global_variables_initializer'