nvflare.app_opt.tracking.tb.tb_event_writer module

class TensorBoardEventWriter(log_dir: str)[source]

Bases: object

Framework-neutral TensorBoard writer backed by tensorboard’s EventFileWriter.

The standalone tensorboard package exposes the low-level event-file writer, but not a high-level SummaryWriter that avoids importing PyTorch or TensorFlow. This adapter preserves the TensorBoard-like methods used by TBAnalyticsReceiver while keeping the dependency surface limited to tensorboard.

When global_step is omitted, the event step is left unset and TensorBoard treats it as step 0. This matches PyTorch’s SummaryWriter behavior, so callers should provide explicit steps for time-series plots.

add_image(tag: str, img_tensor, global_step: int | None = None)[source]
add_scalar(tag: str, scalar_value: float, global_step: int | None = None)[source]
add_scalars(main_tag: str, tag_scalar_dict: dict, global_step: int | None = None)[source]
add_text(tag: str, text_string: str, global_step: int | None = None)[source]
close()[source]
flush()[source]