DeviceStatsMonitor¶
- class pytorch_lightning.callbacks.DeviceStatsMonitor[source]¶
Bases:
pytorch_lightning.callbacks.base.Callback
Automatically monitors and logs device stats during training stage.
DeviceStatsMonitor
is a special callback as it requires alogger
to passed as argument to theTrainer
.- Raises
MisconfigurationException – If
Trainer
has no logger.
Example
>>> from pytorch_lightning import Trainer >>> from pytorch_lightning.callbacks import DeviceStatsMonitor >>> device_stats = DeviceStatsMonitor() >>> trainer = Trainer(callbacks=[device_stats])
- on_train_batch_end(trainer, pl_module, outputs, batch, batch_idx, unused=0)[source]¶
Called when the train batch ends.
- Return type