TensorFlow定義通用入口點(diǎn)腳本

2018-09-07 13:54 更新

#版權(quán)所有2015 TensorFlow作者.版權(quán)所有.

#根據(jù)Apache許可證版本2.0(“許可證”)許可;

#除非符合許可證,否則您不得使用此文件.

#您可以獲得許可證的副本

#http      ://www.apache.org/licenses/LICENSE-2.0

#除非適用法律要求或書(shū)面同意軟件

根據(jù)許可證分發(fā)的#分發(fā)在“按原樣”基礎(chǔ)上,

#無(wú)明示或暗示的任何種類(lèi)的保證或條件.

#查看有關(guān)權(quán)限的特定語(yǔ)言的許可證

#許可證下的限制.

# =============================================== =============================

""通用入口點(diǎn)腳本.""

from __future__ import absolute_import

from __future__ import division

from __future__ import print_function

import sys as _sys

from tensorflow.python.platform import flags

from tensorflow.python.util.all_util import remove_undocumented

def _benchmark_tests_can_log_memory():

  return True

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

  # Parse the known flags from that list, or from the command

  # line otherwise.

  # pylint: disable=protected-access

  flags_passthrough = f._parse_flags(args=args)

  # pylint: enable=protected-access

  main = main or _sys.modules['__main__'].main

  # Call the main function, passing through any arguments

  # to the final program.

  _sys.exit(main(_sys.argv[:1] + flags_passthrough))

_allowed_symbols = [

    'run',

    # Allowed submodule.

    'flags',

]

remove_undocumented(__name__, _allowed_symbols)

以上內(nèi)容是否對(duì)您有幫助:
在線(xiàn)筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號(hào)
微信公眾號(hào)

編程獅公眾號(hào)