xlstm_jax.trainer.logger.tensorboard_logger
===========================================

.. py:module:: xlstm_jax.trainer.logger.tensorboard_logger


Attributes
----------

.. autoapisummary::

   xlstm_jax.trainer.logger.tensorboard_logger.LOGGER


Classes
-------

.. autoapisummary::

   xlstm_jax.trainer.logger.tensorboard_logger.TensorBoardLoggerConfig
   xlstm_jax.trainer.logger.tensorboard_logger.TensorBoardLogger


Module Contents
---------------

.. py:data:: LOGGER

.. py:class:: TensorBoardLoggerConfig

   Bases: :py:obj:`xlstm_jax.trainer.logger.base_logger.LoggerToolsConfig`


   Configuration for the TensorBoard logger tool.

   .. attribute:: tb_flush_secs

      The frequency at which to flush the tensorboard logs.

   .. attribute:: tb_max_queue

      The maximum number of items to queue before flushing.

   .. attribute:: tb_new_style

      Whether to use the new style of logging. See PyTorch
      SummaryWriter documentation for more information.

   .. attribute:: log_dir

      The directory to use for the logs. Is added to the
      log_path in the logger


   .. py:attribute:: tb_flush_secs
      :type:  int
      :value: 120



   .. py:attribute:: tb_max_queue
      :type:  int
      :value: 10



   .. py:attribute:: tb_new_style
      :type:  bool
      :value: False



   .. py:attribute:: log_dir
      :type:  str
      :value: 'tensorboard'



   .. py:method:: create(logger)

      Creates the TensorBoard logger tool.



.. py:class:: TensorBoardLogger(config, logger)

   Bases: :py:obj:`xlstm_jax.trainer.logger.base_logger.LoggerTool`


   .. py:attribute:: config


   .. py:attribute:: config_to_log
      :value: None



   .. py:attribute:: logger


   .. py:attribute:: writer
      :type:  torch.utils.tensorboard.SummaryWriter
      :value: None



   .. py:method:: log_config(config)

      Log the config to TensorBoard.

      If the writer is not set up, the config will be saved and logged
      when the writer is set up.

      :param config: The config to log.



   .. py:method:: _log_config()

      Logs stored config to TensorBoard if writer is set up.



   .. py:method:: setup()

      Set up the TensorBoard logger.

      If the writer is already set up, this function skips the setup.



   .. py:method:: log_metrics(metrics, step, epoch, mode)

      Log a single metric dictionary in the TensorBoard logger.

      :param metrics: The metrics to log.
      :param step: The current step.
      :param epoch: The current epoch. Currently unused.
      :param mode: The mode of logging. Commonly "train", "val", or "test". Is used as prefix for the metric keys.



   .. py:method:: finalize(status)

      Close the TensorBoard logger.

      :param status: The status of the training run (e.g. success, failure).



