from absl import app, flags, logging flags.DEFINE_string('type', '','input type.') flags.DEFINE_integer('index', 0,'input idnex') FLAGS = flags.FLAGS print(FLAGS.type) print(FLAGS.index) 在命令行输入 python test.py --index=0 --type=ps 结果: ps 0版权...
importtensorflowastf#第一个是参数名称,第二个参数是默认值,第三个是参数描述tf.app.flags.DEFINE_string('str_name','def_v_1',"descrip1")tf.app.flags.DEFINE_integer('int_name',10,"descript2")tf.app.flags.DEFINE_boolean('bool_name',False,"descript3")FLAGS=tf.app.flags.FLAGS#必须带参数,...
tf.app.flags.DEFINE_string("log_dir", "./logs", " the log dir") tf.app.flags.DEFINE_integer("train_batch_size", 128, "batch size of train data") tf.app.flags.DEFINE_integer("test_batch_size", 64, "batch size of test data") tf.app.flags.DEFINE_float("learning_rate", 0.001,...