Argparse error with TensorFlow's cifar10.py

人盡茶涼 提交于 2019-12-02 10:03:00
hpaulj

In the cifr10.py file:

import tensorflow as tf

from tensorflow.models.image.cifar10 import cifar10_input

FLAGS = tf.app.flags.FLAGS

# Basic model parameters.
tf.app.flags.DEFINE_integer('batch_size', 128,
                            """Number of images to process in a batch.""")
....

The error is produced by this last statement, which, in the _flags.py file, defines an argparse argument with that name. Evidently at this point the tf.app already has such an argument define.

So we need to look further back at import tensorflow as tf to see how tf.app was created?

What's the Amazon g2.2xlarge? Could that defining batch_size as well?

Looks like tf.app comes from

tensorflow/python/platform/app.py

which in turn gets it from something like

from tensorflow.python.platform.google._app import *

So if you are running this on some google or amazon platform that itself accepts batch_size parameter, it could produce this error.


Another question about cifr10 and the batch_size argument:

How to use "FLAGS" (command line switches) in TensorFlow?

Same error here:

Tensorflow ArgumentError Running CIFAR-10 example The answer says to use cifar10_train.py,cifar10_eval.py, not cifar10.py.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!