本文整理汇总了Python中tensorflow.__git_version__方法的典型用法代码示例。如果您正苦于以下问题:Python tensorflow.__git_version__方法的具体用法?Python tensorflow.__git_version__怎么用?Python tensorflow.__git_version__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tensorflow
的用法示例。
在下文中一共展示了tensorflow.__git_version__方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _ensure_tf2
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import __git_version__ [as 别名]
def _ensure_tf2():
"""Ensure running with TensorFlow 2 behavior.
This function is safe to call even before flags have been parsed.
Raises:
ImportError: If tensorflow is too old for proper TF2 behavior.
"""
print("Running with tensorflow %s (git version %s)",
tf.__version__, tf.__git_version__)
if tf.__version__.startswith("1."):
if tf.__git_version__ == "unknown": # For internal testing use.
try:
tf.compat.v1.enable_v2_behavior()
return
except AttributeError:
pass # Fail below for missing enabler function.
raise ImportError("Sorry, this program needs TensorFlow 2.")
示例2: main
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import __git_version__ [as 别名]
def main(_):
logging.info('Current tf version: %s', tf.__version__)
logging.info('Current tf git version: %s', tf.__git_version__)
run_training()
示例3: testGitAndCompilerVersion
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import __git_version__ [as 别名]
def testGitAndCompilerVersion(self):
self.assertEqual(type(tf.__git_version__), str)
self.assertEqual(type(tf.__compiler_version__), str)
self.assertEqual(type(tf.GIT_VERSION), str)
self.assertEqual(type(tf.COMPILER_VERSION), str)
示例4: tensorflow_python_version
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import __git_version__ [as 别名]
def tensorflow_python_version():
import tensorflow as tf
logging.info("tensorflow.__version__: %r", tf.__version__)
logging.info("tensorflow.__git_version__: %r", tf.__git_version__)