analogvnn.utils.TensorboardModelLog
#
Module Contents#
Classes#
Tensorboard model log. |
- class analogvnn.utils.TensorboardModelLog.TensorboardModelLog(model: analogvnn.nn.module.Model.Model, log_dir: str)[source]#
Tensorboard model log.
- Variables:
- model: torch.nn.Module[source]#
- set_log_dir(log_dir: str) TensorboardModelLog [source]#
Set the log directory.
- Parameters:
log_dir (str) – the log directory.
- Returns:
self.
- Return type:
- Raises:
ValueError – if the log directory is invalid.
- _add_layer_data(epoch: int = None)[source]#
Add the layer data to the tensorboard.
- Parameters:
epoch (int) – the epoch to add the data for.
- on_compile(layer_data: bool = True)[source]#
Called when the model is compiled.
- Parameters:
layer_data (bool) – whether to log the layer data.
- add_graph(train_loader: torch.utils.data.DataLoader, model: Optional[torch.nn.Module] = None, input_size: Optional[Sequence[int]] = None) TensorboardModelLog [source]#
Add the model graph to the tensorboard.
- Parameters:
train_loader (DataLoader) – the train loader.
model (Optional[nn.Module]) – the model to log.
input_size (Optional[Sequence[int]]) – the input size.
- Returns:
self.
- Return type:
- add_summary(input_size: Optional[Sequence[int]] = None, train_loader: Optional[torch.utils.data.DataLoader] = None, model: Optional[torch.nn.Module] = None, *args, **kwargs) Tuple[str, str] [source]#
Add the model summary to the tensorboard.
- Parameters:
input_size (Optional[Sequence[int]]) – the input size.
train_loader (Optional[DataLoader]) – the train loader.
model (nn.Module) – the model to log.
*args – the arguments to torchinfo.summary.
**kwargs – the keyword arguments to torchinfo.summary.
- Returns:
the model __repr__ and the model summary.
- Return type:
- register_training(epoch: int, train_loss: float, train_accuracy: float) TensorboardModelLog [source]#
Register the training data.
- Parameters:
- Returns:
self.
- Return type:
- register_testing(epoch: int, test_loss: float, test_accuracy: float) TensorboardModelLog [source]#
Register the testing data.
- Parameters:
- Returns:
self.
- Return type:
- close(*args, **kwargs)[source]#
Close the tensorboard.
- Parameters:
*args – ignored.
**kwargs – ignored.