if __name__ == "__main__": tf.app.run()

if __name__ == "__main__": means current file is executed under a shell instead of imported as a module.
the job of tf.app.run() is to first set the global flags for later usage like

    from tensorflow.python.platform import flags

    f = flags.FLAGS

and then run your custom main function with a set of arguments.

posted @ 2018-06-13 04:40  qingliu411  阅读(217)  评论(0编辑  收藏  举报