Shortcuts

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 a logger to passed as argument to the Trainer.

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

None

on_train_batch_start(trainer, pl_module, batch, batch_idx, unused=0)[source]

Called when the train batch begins.

Return type

None

setup(trainer, pl_module, stage=None)[source]

Called when fit, validate, test, predict, or tune begins.

Return type

None