简体   繁体   English

Tensorboard DuplicateFlagError

[英]Tensorboard DuplicateFlagError

I'm modifying tensorboards example code for CNN's: https://www.tensorflow.org/tutorials/deep_cnn#launching_and_training_the_model 我正在为CNN修改张量板示例代码: 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. 看起来您正在某种程度上运行两次定义了batch_size参数的代码块。 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. 可能的是,如果您是从jupyter Notebook运行它的,并且您正在重新运行单元格(也许在某些代码更改之后),则不会清除标志,而是尝试再次定义它。 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. 如果这些都不适用,则您必须发布代码(包括运行方式的说明)才能发表更多意见。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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