本文整理匯總了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__)