本文整理汇总了Python中tensorflow.GIT_VERSION属性的典型用法代码示例。如果您正苦于以下问题:Python tensorflow.GIT_VERSION属性的具体用法?Python tensorflow.GIT_VERSION怎么用?Python tensorflow.GIT_VERSION使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类tensorflow
的用法示例。
在下文中一共展示了tensorflow.GIT_VERSION属性的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _collect_tensorflow_info
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import GIT_VERSION [as 别名]
def _collect_tensorflow_info(run_info):
run_info["tensorflow_version"] = {
"version": tf.VERSION, "git_hash": tf.GIT_VERSION}
示例2: 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)
示例3: _construct_and_save_reference_files
# 需要导入模块: import tensorflow [as 别名]
# 或者: from tensorflow import GIT_VERSION [as 别名]
def _construct_and_save_reference_files(
self, name, graph, ops_to_eval, correctness_function):
"""Save reference data files.
Constructs a serialized graph_def, layer weights, and computation results.
It then saves them to files which are read at test time.
Args:
name: String defining the run. This will be used to define folder names
and will be used for random seed construction.
graph: The graph in which the test is conducted.
ops_to_eval: Ops which the user wishes to be evaluated under a controlled
session.
correctness_function: This function accepts the evaluated results of
ops_to_eval, and returns a list of values. This list must be JSON
serializable; in particular it is up to the user to convert numpy
dtypes into builtin dtypes.
"""
data_dir = os.path.join(self.data_root, name)
# Make sure there is a clean space for results.
if os.path.exists(data_dir):
shutil.rmtree(data_dir)
os.makedirs(data_dir)
# Serialize graph for comparison.
graph_bytes = graph.as_graph_def().SerializeToString()
expected_file = os.path.join(data_dir, "expected_graph")
with tf.gfile.Open(expected_file, "wb") as f:
f.write(graph_bytes)
with graph.as_default():
init = tf.global_variables_initializer()
saver = tf.train.Saver()
with self.test_session(graph=graph) as sess:
sess.run(init)
saver.save(sess=sess, save_path=os.path.join(data_dir, self.ckpt_prefix))
# These files are not needed for this test.
os.remove(os.path.join(data_dir, "checkpoint"))
os.remove(os.path.join(data_dir, self.ckpt_prefix + ".meta"))
# ops are evaluated even if there is no correctness function to ensure
# that they can be evaluated.
eval_results = [op.eval() for op in ops_to_eval]
if correctness_function is not None:
results = correctness_function(*eval_results)
with tf.gfile.Open(os.path.join(data_dir, "results.json"), "w") as f:
json.dump(results, f)
with tf.gfile.Open(os.path.join(data_dir, "tf_version.json"), "w") as f:
json.dump([tf.VERSION, tf.GIT_VERSION], f)