當前位置: 首頁>>代碼示例>>Python>>正文


Python tensorflow.GIT_VERSION屬性代碼示例

本文整理匯總了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} 
開發者ID:rockyzhengwu,項目名稱:nsfw,代碼行數:5,代碼來源:logger.py

示例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) 
開發者ID:tobegit3hub,項目名稱:deep_image_model,代碼行數:7,代碼來源:versions_test.py

示例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) 
開發者ID:rockyzhengwu,項目名稱:nsfw,代碼行數:56,代碼來源:reference_data.py


注:本文中的tensorflow.GIT_VERSION屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。