diff --git a/docs/source/hooks.rst b/docs/source/hooks.rst index 0cade1c4..56ba52c5 100644 --- a/docs/source/hooks.rst +++ b/docs/source/hooks.rst @@ -1,9 +1,10 @@ -Hooks -======= -This is the order in which lightning calls the hooks. You can override each for custom behavior. +.. automodule:: pytorch_lightning.core.hooks + +Full list of hooks +------------------ Training set-up --------------------- +=============== - init_ddp_connection - init_optimizers - configure_apex @@ -15,7 +16,7 @@ Training set-up - restore_weights Training loop --------------------- +============= - on_epoch_start - on_batch_start @@ -29,7 +30,7 @@ Training loop - on_epoch_end Validation loop --------------------- +=============== - model.zero_grad() - model.eval() @@ -41,7 +42,7 @@ Validation loop - on_post_performance_check Test loop ------------- +========= - model.zero_grad() - model.eval() diff --git a/docs/source/index.rst b/docs/source/index.rst index 3232e74f..7a04bdff 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -19,10 +19,12 @@ PyTorch-Lightning Documentation :caption: Python API callbacks + hooks lightning-module loggers trainer + .. toctree:: :maxdepth: 1 :name: Examples diff --git a/pytorch_lightning/core/hooks.py b/pytorch_lightning/core/hooks.py index dca3b36c..500ba247 100644 --- a/pytorch_lightning/core/hooks.py +++ b/pytorch_lightning/core/hooks.py @@ -6,8 +6,11 @@ There are cases when you might want to do something different at different parts To enable a hook, simply override the method in your LightningModule and the trainer will call it at the correct time. **Contributing** If there's a hook you'd like to add, simply: + 1. Fork PyTorchLightning. + 2. Add the hook :py:mod:`pytorch_lightning.base_module.hooks.py`. + 3. Add the correct place in the :py:mod:`pytorch_lightning.models.trainer` where it should be called. """