TensorboardLogger

class hybrid_learning.concepts.train_eval.callbacks.TensorboardLogger(log_dir='runs', log_sample_inputs=False, log_sample_targets=False)[source]

Bases: Callback

Write batch and epoch KPI results to a tensorboard log directory.

Public Methods:

flush_writers()

Close all writers to free their threads.

before_epoch_train(model, train_loader[, ...])

Log the model graph and optionally some example training images.

after_batch_train(kpi_train, batch, batches, ...)

Record the training KPIs in the tensorboard log directory.

after_epoch_train(kpi_train, epoch[, ...])

After each training epoch, close all writers to free threads.

after_epoch_eval(kpi_val[, epoch, ...])

Record the validation and test KPIs in the tensorboard log directory.

Inherited from : py: class:Callback

keys()

Collect a list of all supported callback events.

Inherited from : py: class:Mapping

get(k[,d])

keys()

Collect a list of all supported callback events.

items()

values()

Special Methods:

__init__([log_dir, log_sample_inputs, ...])

Inherited from : py: class:Callback

__getitem__(event)

Get the method for the specified event or a pass lambda.

__len__()

Number of mapped events.

__iter__()

Iterate over mapped events.

Inherited from : py: class:Mapping

__getitem__(event)

Get the method for the specified event or a pass lambda.

__contains__(key)

__eq__(other)

Return self==value.

Inherited from : py: class:Sized

__len__()

Number of mapped events.

Inherited from : py: class:Iterable

__iter__()

Iterate over mapped events.

Inherited from : py: class:Container

__contains__(key)


__init__(log_dir='runs', log_sample_inputs=False, log_sample_targets=False)[source]
Parameters
  • log_dir (str) –

  • log_sample_inputs (bool) –

  • log_sample_targets (bool) –

after_batch_train(kpi_train, batch, batches, epoch, log_prefix=None, run=None, **_)[source]

Record the training KPIs in the tensorboard log directory.

Parameters
after_epoch_eval(kpi_val, epoch=None, log_prefix=None, run=None, **_)[source]

Record the validation and test KPIs in the tensorboard log directory.

Parameters
after_epoch_train(kpi_train, epoch, aggregating_kpis=(), log_prefix=None, run=None, **_)[source]

After each training epoch, close all writers to free threads.

Parameters
before_epoch_train(model, train_loader, epoch=0, log_prefix=None, run=None, device=None, **_)[source]

Log the model graph and optionally some example training images.

Parameters
flush_writers()[source]

Close all writers to free their threads.

__parameters__ = ()
log_dir: str

The root logging directory.

log_sample_inputs: bool

Whether to interpret the model inputs as image and log some.

log_sample_targets: bool

Whether to interpret the model targets as image and log some.

writers: Dict[str, SummaryWriter]

A mapping of logdir subdirectory to cached writers.