import tensorflow as tf #参数说明 (变量名,值,说明) tf.app.flags.DEFINE_string( 'master', 'variable', 'The address of the TensorFlow master to use.') tf.app.flags.DEFINE_integer( 'worker_replicas', 1, 'Number of worker replicas.') tf.app.flags.DEFINE_float( 'weight_decay', 0.00004, 'The weight decay on the model weights.') tf.app.flags.DEFINE_boolean( 'clone_on_cpu', False,'Use CPUs to deploy clones.') FLAGS = tf.app.flags.FLAGS print(FLAGS.master) print(FLAGS.worker_replicas) print(FLAGS.weight_decay) print(FLAGS.clone_on_cpu) ''' 输出结果: variable 1 4e-05 False ''' ''' 访问方式1: 需要改变的参数值的需要用--变量名=value python3 flags.py --master=123 --worker_replicas=3 访问方式2: 直接运行,进行操作 '''
TensorFlow中的tf.app.flags使用
猜你喜欢
转载自blog.csdn.net/qq_30638831/article/details/80789654
今日推荐
周排行