Advertisement

tensorflow学习:tf.app.run

阅读量:

tensorflow中的tf.app.run()函数

如需转载,请务必注明原始出处!

复制代码
    # 省略import
    
    if __name__ = '__main__':
    	tf.app.run()
    
    
    AI写代码python
    
    运行

tf.app.run() 是函数入口,类似于c++中的main()

从run()函数的源码说明可以看出,通常情况下,执行一个程序需要以main函数作为起点,并且该函数通常包含参数argv用于获取用户输入。在TensorFlow框架中,tf.app.run()的作用等同于这一main()函数,同时具备参数解析的功能。附上run()函数的源码

复制代码
    def run(main=None, argv=None):
      """Runs the program with an optional 'main' function and 'argv' list."""
      f = flags.FLAGS
    
      # Extract the args from the optional `argv` list.
      args = argv[1:] if argv else None
    
      #

全部评论 (0)

还没有任何评论哟~