1
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Tensorflow API: FLAGS

Last updated at Posted at 2017-06-26

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.定数名)

1
7
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
7

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?