Help us understand the problem. What is going on with this article?

Tensorflow API: FLAGS

More than 1 year has passed since last update.

FLAGSとは

https://www.tensorflow.org/api_docs/python/tf/flags

  • Tensorflowで使用する定数を定義する
  • 実行時に、コマンドラインからパラメーターを与えることができるようになる

$ python file.py --[parameter_name]

  • 定数の説明を与えると、実行時に--helpで定数の説明を見ることができる

$ python file.py --help

使い方

# 定義用のflagを作成
flags = tf.app.flags

# 参照用のflagを作成
FLAGS = flags.FLAGS

# stringの定義
flags.DEFINE_string(定数名, 初期値, 説明文)

# floatの定義
flags.DEFINE_float(定数名, 初期値, 説明文)

# intの定義
flags.DEFINE_integer(定数名, 初期値, 説明文)

# boolの定義
flags.DEFINE_boolean(定数名, 初期値, 説明文)

# 定数の参照
print(FLAGS.定数名)

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away