def testRespectsGraphArgument(self): g1 = ops.Graph() g2 = ops.Graph() e1 = plugin_asset.get_plugin_asset(_ExamplePluginAsset, g1) e2 = plugin_asset.get_plugin_asset(_ExamplePluginAsset, g2) self.assertEqual(e1, plugin_asset.get_all_plugin_assets(g1)[0]) self.assertEqual(e2, plugin_asset.get_all_plugin_assets(g2)[0])
def testRespectsGraphArgument(self): g1 = ops.Graph() g2 = ops.Graph() e1 = plugin_asset.get_plugin_asset(_ExamplePluginAsset, g1) e2 = plugin_asset.get_plugin_asset(_ExamplePluginAsset, g2) self.assertEqual(e1, plugin_asset.get_all_plugin_assets(g1)[0]) self.assertEqual(e2, plugin_asset.get_all_plugin_assets(g2)[0])
def _write_tensorboard_metadata(self, graph): assets = plugin_asset.get_all_plugin_assets(graph) logdir = self.event_writer.get_logdir() for asset in assets: plugin_dir = os.path.join(logdir, _PLUGINS_DIR, asset.plugin_name) gfile.MakeDirs(plugin_dir) asset.serialize_to_directory(plugin_dir)
def _write_plugin_assets(self, graph): plugin_assets = plugin_asset.get_all_plugin_assets(graph) logdir = self.event_writer.get_logdir() for asset_container in plugin_assets: plugin_name = asset_container.plugin_name plugin_dir = os.path.join(logdir, _PLUGINS_DIR, plugin_name) gfile.MakeDirs(plugin_dir) assets = asset_container.assets() for (asset_name, content) in assets.items(): asset_path = os.path.join(plugin_dir, asset_name) with gfile.Open(asset_path, "w") as f: f.write(content)
def testGetAllPluginAssets(self): epa = plugin_asset.get_plugin_asset(_ExamplePluginAsset) opa = plugin_asset.get_plugin_asset(_OtherExampleAsset) self.assertItemsEqual(plugin_asset.get_all_plugin_assets(), [epa, opa])
def testGetAllPluginAssets(self): epa = plugin_asset.get_plugin_asset(_ExamplePluginAsset) opa = plugin_asset.get_plugin_asset(_OtherExampleAsset) self.assertItemsEqual(plugin_asset.get_all_plugin_assets(), [epa, opa])