MCPcopy Create free account
hub / github.com/MaureenZOU/TSAM / __init__

Method __init__

src/utils/visualization.py:6–26  ·  view source on GitHub ↗
(self, writer_dir, logger, enable)

Source from the content-addressed store, hash-verified

4
5class WriterTensorboardX():
6 def __init__(self, writer_dir, logger, enable):
7 self.writer = None
8 if enable:
9 log_path = writer_dir
10 try:
11 self.writer = importlib.import_module('tensorboardX').SummaryWriter(log_path)
12 except ModuleNotFoundError:
13 message = """
14 TensorboardX visualization is configured to use, but currently not installed on this machine.
15 Please install the package by 'pip install tensorboardx' command or turn off the option
16 in the 'config.json' file.
17 """
18 warnings.warn(message, UserWarning)
19 # logger.warn()
20 self.step = 0
21 self.mode = ''
22
23 self.tensorboard_writer_ftns = [
24 'add_scalar', 'add_scalars', 'add_image', 'add_audio', 'add_text', 'add_histogram',
25 'add_pr_curve', 'add_embedding'
26 ]
27
28 def set_step(self, step, mode='train'):
29 self.mode = mode

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected