projector_api_test.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:tensorboard 作者: tensorflow 项目源码 文件源码
def testVisualizeEmbeddings(self):
    # Create a dummy configuration.
    config = projector.ProjectorConfig()
    config.model_checkpoint_path = 'test'
    emb1 = config.embeddings.add()
    emb1.tensor_name = 'tensor1'
    emb1.metadata_path = 'metadata1'

    # Call the API method to save the configuration to a temporary dir.
    temp_dir = self.get_temp_dir()
    self.addCleanup(shutil.rmtree, temp_dir)
    writer = tf.summary.FileWriter(temp_dir)
    projector.visualize_embeddings(writer, config)

    # Read the configurations from disk and make sure it matches the original.
    with tf.gfile.GFile(os.path.join(temp_dir, 'projector_config.pbtxt')) as f:
      config2 = projector.ProjectorConfig()
      text_format.Parse(f.read(), config2)
      self.assertEqual(config, config2)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号