logging_mixin
Implements LoggingMixin, which can be used easily log from any torch.nn.Module
Example
>>> class MyLayer(torch.nn.Module, LoggingMixin):
>>> def forward(self, x, y):
>>> z = x + y
>>> # easily log intermediate value
>>> self.log(x=x, z_intermediate=z)
>>> z = z ** 2
>>> self.log(z_final=z)
>>> return z
- class LoggingMixin[source]
A mixin class for logging.
Use in your
nn.Moduleto log values during training and validation.- _process_log_dict(log_dict: dict) dict[source]
process a dict of things to be logged: log scalars directly, otherwise compute mean, std, abs_max
- property log_dict: dict
A dictionary of values to log.