• Docs >
  • Utils >
  • torchtnt.utils.loggers.TensorBoardLogger
Shortcuts

torchtnt.utils.loggers.TensorBoardLogger

class torchtnt.utils.loggers.TensorBoardLogger(path: str, *args: Any, **kwargs: Any)

Simple logger for TensorBoard.

On construction, the logger creates a new events file that logs will be written to. If the environment variable RANK is defined, logger will only log if RANK = 0.

Note

If using this logger with distributed training:

  • This logger should be constructed on all ranks
  • This logger can call collective operations
  • Logs will be written on rank 0 only
  • Logger must be constructed synchronously after initializing the distributed process group.
Parameters:
  • path (str) – path to write logs to
  • *args – Extra positional arguments to pass to SummaryWriter
  • **kwargs – Extra keyword arguments to pass to SummaryWriter

Examples:

from torchtnt.utils.loggers import TensorBoardLogger
logger = TensorBoardLogger(path="tmp/tb_logs")
logger.log("accuracy", 23.56, 10)
logger.close()
__init__(path: str, *args: Any, **kwargs: Any) None

Methods

__init__(path, *args, **kwargs)
close() Close writer, flushing pending logs to disk.
flush() Writes pending logs to disk.
log(name, data, step) Add scalar data to TensorBoard.
log_audio(*args, **kwargs) Add audio data to TensorBoard.
log_dict(payload, step) Add multiple scalar values to TensorBoard.
log_hparams(hparams, metrics) Add hyperparameter data to TensorBoard.
log_image(*args, **kwargs) Add image data to TensorBoard.
log_images(*args, **kwargs) Add batched image data to summary.
log_scalars(main_tag, tag_scalar_dict[, ...]) Log multiple values to TensorBoard.
log_text(name, data, step) Add text data to summary.

Attributes

path
writer

Docs

Access comprehensive developer documentation for PyTorch

View Docs

Tutorials

Get in-depth tutorials for beginners and advanced developers

View Tutorials

Resources

Find development resources and get your questions answered

View Resources