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)
评论列表
文章目录