每个人,我对cifar10_train.py
做了一点改动,发生错误。
cifar10_train.py
中的原始代码是:
from tensorflow.models.image.cifar10 import cifar10
我将其更改为:
import cifar10.py
import cifar10_eval.py
import cifar10_input.py
原因是我想更改这三个文件中的一些代码,所以我自己导入这些文件而不是从tensorflow导入。在这种情况下,我不会更改这三个文件中的任何内容。
当我运行cifar10_train.py
时,错误显示如下:
ubuntu@ip-172-31-58-100:~$ python cifar10_train.py
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcublas.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcudnn.so.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcufft.so.7.5 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcuda.so.1 locally
I tensorflow/stream_executor/dso_loader.cc:128] successfully opened CUDA library libcurand.so.7.5 locally
Traceback (most recent call last):
File "cifar10_train.py", line 48, in <module>
import cifar10
File "/home/ubuntu/cifar10.py", line 43, in <module>
"""Number of images to process in a batch.""")
File "/usr/local/lib/python2.7/dist packages/tensorflow/python/platform/flags.py", line 91, in DEFINE_integer
_define_helper(flag_name, default_value, docstring, int)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/platform/flags.py", line 65, in _define_helper
type=flagtype)
File "/usr/lib/python2.7/argparse.py", line 1297, in add_argument
return self._add_action(action)
File "/usr/lib/python2.7/argparse.py", line 1671, in _add_action
self._optionals._add_action(action)
File "/usr/lib/python2.7/argparse.py", line 1498, in _add_action
action = super(_ArgumentGroup, self)._add_action(action)
File "/usr/lib/python2.7/argparse.py", line 1311, in _add_action
self._check_conflict(action)
File "/usr/lib/python2.7/argparse.py", line 1449, in _check_conflict
conflict_handler(action, confl_optionals)
File "/usr/lib/python2.7/argparse.py", line 1456, in _handle_conflict_error
raise ArgumentError(action, message % conflict_string)
argparse.ArgumentError: argument --batch_size: conflicting option string(s): --batch_size
感谢任何回答,谢谢!