简体   繁体   中英

Tensorboard DuplicateFlagError

I'm modifying tensorboards example code for CNN's: https://www.tensorflow.org/tutorials/deep_cnn#launching_and_training_the_model

I'm getting this error:

DuplicateFlagError: The flag 'batch_sizes' is defined twice. First from D:/UofU/.../mycifar10.py, Second from D:/UofU/.../mycifar10.py. (Where both path names are the same)  Description from first occurrence: Numbers of images to process in a batch.

This is the jist of the code that must be producing the error:

tf.app.flags.DEFINE_integer('batch_size', 49,
                           """Numbers of images to process in a batch.""")

Looks like somehow you're running the code block defining your batch_size parameter twice. Maybe it's within a function, and you call it multiple times, or some other way.

Possibly, if you're running it from jupyter notebook, and you're re-running the cell (after some code changes, maybe) the flags are not cleared, and you're trying to define it again. In this case you have to restart the runtime before each run of this cell, or alternatively, separate the flags into their own cell, run them once, and run and re-run the rest of the code.

If none of these apply, you have to post your code, including a description of how you run it, to be able to say more.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM