import tensorflow as tf
FLAG = tf.app.flags.FLAGS
tf.app.flags.DEFINE_string("name","haoren","NAME")
def run():
FLAG.name = "huairen"
print(FLAG.name)
def main(_):
run()
return
if __name__ == '__main__':
tf.app.run()
运行结果:
注意!!!
main(_)一定要带个参数