gpt4 book ai didi

python - 如何在 Tensorflow 中打印标志描述?

转载 作者:太空宇宙 更新时间:2023-11-03 12:38:24 25 4
gpt4 key购买 nike

Google 有许多使用标志的示例。它们在定义中都有描述。有什么方法可以将这些描述打印到终端吗?

flags = tf.app.flags
FLAGS = flags.FLAGS
flags.DEFINE_boolean('test_mode', False, 'This is the description I want A.')
flags.DEFINE_boolean('cool_mode', True, 'This is the description I want B.')

最佳答案

TensorFlow 中使用的 flags 模块是 python-gflags module 的包装器.要使用 python-gflags 查看 Python 应用程序中使用的所有标志的列表,您可以使用 -h--help 运行它旗帜。例如:

$ tensorboard -h
usage: tensorboard [-h] [--logdir LOGDIR] [--debug DEBUG] [--nodebug]
[--host HOST] [--port PORT]

optional arguments:
-h, --help show this help message and exit
--logdir LOGDIR logdir specifies where TensorBoard will look to find
TensorFlow event files that it can display. In the simplest
case, logdir is a directory containing tfevents files.
TensorBoard also supports comparing multiple TensorFlow
executions: to do this, you can use directory whose
subdirectories contain tfevents files, as in the following
example: foo/bar/logdir/
foo/bar/logdir/mnist_1/events.out.tfevents.1444088766
foo/bar/logdir/mnist_2/events.out.tfevents.1444090064 You
may also pass a comma seperated list of log directories,
and you can assign names to individual log directories by
putting a colon between the name and the path, as in
tensorboard
--logdir=name1:/path/to/logs/1,name2:/path/to/logs/2
--debug DEBUG Whether to run the app in debug mode. This increases log
verbosity to DEBUG.
--nodebug
--host HOST What host to listen to. Defaults to allowing remote access,
set to 127.0.0.1 to serve only on localhost.
--port PORT What port to serve TensorBoard on.

关于python - 如何在 Tensorflow 中打印标志描述?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34314455/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com