当前位置: 首页>>代码示例>>Python>>正文


Python program.TensorBoard方法代码示例

本文整理汇总了Python中tensorboard.program.TensorBoard方法的典型用法代码示例。如果您正苦于以下问题:Python program.TensorBoard方法的具体用法?Python program.TensorBoard怎么用?Python program.TensorBoard使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在tensorboard.program的用法示例。


在下文中一共展示了program.TensorBoard方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: start_tf_board

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def start_tf_board(client: skein.ApplicationClient, tf_board_model_dir: str):
    task = cluster.get_task()
    os.environ['GCS_READ_CACHE_DISABLED'] = '1'
    os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION'] = 'cpp'
    os.environ['PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION_VERSION'] = '2'
    try:
        program.setup_environment()
        tensorboard = program.TensorBoard()
        with _internal.reserve_sock_addr() as (h, p):
            tensorboard_url = f"http://{h}:{p}"
            argv = ['tensorboard', f"--logdir={tf_board_model_dir}",
                    f"--port={p}"]
            tb_extra_args = os.getenv('TB_EXTRA_ARGS', "")
            if tb_extra_args:
                argv += tb_extra_args.split(' ')
            tensorboard.configure(argv)
        tensorboard.launch()
        event.start_event(client, task)
        event.url_event(client, task, f"{tensorboard_url}")
    except Exception as e:
        _logger.error("Cannot start tensorboard", e)
        event.stop_event(client, task, e) 
开发者ID:criteo,项目名称:tf-yarn,代码行数:24,代码来源:tensorboard.py

示例2: run

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def run(self):
        try:
            from tensorboard import program
        except ModuleNotFoundError:
            raise Deactivated("Please install tensorboard to perform this analysis!")

        if len(self.runscontainer.get_folders()) != 1:
            raise ValueError("Undefined behaviour for multiple APT-outputs...")
        run = self.runscontainer.get_aggregated(keep_budgets=False, keep_folders=True)[0]

        # This line will need to be adapted
        single_tfevents_file = run.share_information['tfevents_paths'][0]
        tfevents_dir = os.path.split(single_tfevents_file)[0]
        self.logger.info("Tensorboard base dir: %s", tfevents_dir)
        print(tfevents_dir)

        #for config in traj['config']:
        #    self.runscontainer.get_tensorboard_result(config['config'])

        tb = program.TensorBoard()
        tb.configure(argv=[None, '--logdir', tfevents_dir])
        url = tb.launch()

        self.result["else"] = " <iframe src=" + url + " width=\"950\" height=\"700\"></iframe> " 
开发者ID:automl,项目名称:CAVE,代码行数:26,代码来源:apt_tensorboard.py

示例3: enable_tensorboard

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def enable_tensorboard(self):
        with self._data_lock:
            if not self._tensor_board_dir:
                tb = program.TensorBoard()
                tb.configure(argv=[None, "--logdir", str(self._logdir)])
                tb.launch()
                self._tensor_board_dir = self._logdir 
开发者ID:ray-project,项目名称:ray,代码行数:9,代码来源:dashboard.py

示例4: run_main

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def run_main():
    """Initializes flags and calls main()."""
    program.setup_environment()

    if getattr(tf, "__version__", "stub") == "stub":
        print(
            "TensorFlow installation not found - running with reduced feature set.",
            file=sys.stderr,
        )

    tensorboard = program.TensorBoard(
        default.get_plugins(),
        program.get_default_assets_zip_provider(),
        subcommands=[uploader_subcommand.UploaderSubcommand()],
    )
    try:
        from absl import app

        # Import this to check that app.run() will accept the flags_parser argument.
        from absl.flags import argparse_flags

        app.run(tensorboard.main, flags_parser=tensorboard.configure)
        raise AssertionError("absl.app.run() shouldn't return")
    except ImportError:
        pass
    except base_plugin.FlagsError as e:
        print("Error: %s" % e, file=sys.stderr)
        sys.exit(1)

    tensorboard.configure(sys.argv)
    sys.exit(tensorboard.main()) 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:33,代码来源:main.py

示例5: testPlugins_pluginClass

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testPlugins_pluginClass(self):
        tb = program.TensorBoard(plugins=[core_plugin.CorePlugin])
        self.assertIsInstance(tb.plugin_loaders[0], base_plugin.BasicLoader)
        self.assertIs(tb.plugin_loaders[0].plugin_class, core_plugin.CorePlugin) 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:6,代码来源:program_test.py

示例6: testPlugins_pluginLoaderClass

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testPlugins_pluginLoaderClass(self):
        tb = program.TensorBoard(plugins=[core_plugin.CorePluginLoader])
        self.assertIsInstance(
            tb.plugin_loaders[0], core_plugin.CorePluginLoader
        ) 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:7,代码来源:program_test.py

示例7: testPlugins_pluginLoader

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testPlugins_pluginLoader(self):
        loader = core_plugin.CorePluginLoader()
        tb = program.TensorBoard(plugins=[loader])
        self.assertIs(tb.plugin_loaders[0], loader) 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:6,代码来源:program_test.py

示例8: testPlugins_invalidType

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testPlugins_invalidType(self):
        plugin_instance = core_plugin.CorePlugin(base_plugin.TBContext())
        with six.assertRaisesRegex(self, TypeError, "CorePlugin"):
            tb = program.TensorBoard(plugins=[plugin_instance]) 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:6,代码来源:program_test.py

示例9: testConfigure_unknownFlag

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testConfigure_unknownFlag(self):
        tb = program.TensorBoard(plugins=[core_plugin.CorePlugin])
        with six.assertRaisesRegex(
            self, ValueError, "Unknown TensorBoard flag"
        ):
            tb.configure(foo="bar") 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:8,代码来源:program_test.py

示例10: setUp

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def setUp(self):
        super(SubcommandTest, self).setUp()
        self.stderr = six.StringIO()
        patchers = [
            mock.patch.object(program.TensorBoard, "_install_signal_handler"),
            mock.patch.object(program.TensorBoard, "_run_serve_subcommand"),
            mock.patch.object(_TestSubcommand, "run"),
            mock.patch.object(sys, "stderr", self.stderr),
        ]
        for p in patchers:
            p.start()
            self.addCleanup(p.stop)
        _TestSubcommand.run.return_value = None 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:15,代码来源:program_test.py

示例11: testImplicitServe

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testImplicitServe(self):
        tb = program.TensorBoard(
            plugins=[core_plugin.CorePluginLoader],
            subcommands=[_TestSubcommand(lambda parser: None)],
        )
        tb.configure(("tb", "--logdir", "logs", "--path_prefix", "/x///"))
        tb.main()
        program.TensorBoard._run_serve_subcommand.assert_called_once()
        flags = program.TensorBoard._run_serve_subcommand.call_args[0][0]
        self.assertEqual(flags.logdir, "logs")
        self.assertEqual(flags.path_prefix, "/x")  # fixed by core_plugin 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:13,代码来源:program_test.py

示例12: testExplicitServe

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testExplicitServe(self):
        tb = program.TensorBoard(
            plugins=[core_plugin.CorePluginLoader],
            subcommands=[_TestSubcommand()],
        )
        tb.configure(
            ("tb", "serve", "--logdir", "logs", "--path_prefix", "/x///")
        )
        tb.main()
        program.TensorBoard._run_serve_subcommand.assert_called_once()
        flags = program.TensorBoard._run_serve_subcommand.call_args[0][0]
        self.assertEqual(flags.logdir, "logs")
        self.assertEqual(flags.path_prefix, "/x")  # fixed by core_plugin 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:15,代码来源:program_test.py

示例13: testSubcommand

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testSubcommand(self):
        def define_flags(parser):
            parser.add_argument("--hello")

        tb = program.TensorBoard(
            plugins=[core_plugin.CorePluginLoader],
            subcommands=[_TestSubcommand(define_flags=define_flags)],
        )
        tb.configure(("tb", "test", "--hello", "world"))
        self.assertEqual(tb.main(), 0)
        _TestSubcommand.run.assert_called_once()
        flags = _TestSubcommand.run.call_args[0][0]
        self.assertEqual(flags.hello, "world") 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:15,代码来源:program_test.py

示例14: testSubcommand_DoesNotInheritBaseArgs

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testSubcommand_DoesNotInheritBaseArgs(self):
        tb = program.TensorBoard(
            plugins=[core_plugin.CorePluginLoader],
            subcommands=[_TestSubcommand()],
        )
        with self.assertRaises(SystemExit):
            tb.configure(("tb", "test", "--logdir", "logs"))
        self.assertIn(
            "unrecognized arguments: --logdir logs", self.stderr.getvalue()
        )
        self.stderr.truncate(0) 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:13,代码来源:program_test.py

示例15: testSubcommand_MayRequirePositionals

# 需要导入模块: from tensorboard import program [as 别名]
# 或者: from tensorboard.program import TensorBoard [as 别名]
def testSubcommand_MayRequirePositionals(self):
        def define_flags(parser):
            parser.add_argument("payload")

        tb = program.TensorBoard(
            plugins=[core_plugin.CorePluginLoader],
            subcommands=[_TestSubcommand(define_flags=define_flags)],
        )
        with self.assertRaises(SystemExit):
            tb.configure(("tb", "test"))
        self.assertIn("required", self.stderr.getvalue())
        self.assertIn("payload", self.stderr.getvalue())
        self.stderr.truncate(0) 
开发者ID:tensorflow,项目名称:tensorboard,代码行数:15,代码来源:program_test.py


注:本文中的tensorboard.program.TensorBoard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。