From 6f3777d2ebaaff241a77b44e7c5696b8cf1de285 Mon Sep 17 00:00:00 2001 From: siahuat0727 Date: Mon, 1 Feb 2021 21:09:01 +0800 Subject: [PATCH] Fix docs typo (#4930) * Fix docs * typo * import * Apply suggestions from code review Co-authored-by: Jirka Borovec Co-authored-by: chaton Co-authored-by: Jirka Borovec Co-authored-by: edenlightning <66261195+edenlightning@users.noreply.github.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> --- docs/source/conf.py | 12 ++++++++++++ docs/source/starter/style_guide.rst | 14 +++++++------- pytorch_lightning/core/lightning.py | 2 +- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/docs/source/conf.py b/docs/source/conf.py index 99abe432e47f85..3856a3df5b5e98 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -376,6 +376,7 @@ def package_list_from_file(file): from torch import nn import pytorch_lightning as pl +<<<<<<< HEAD from pytorch_lightning import LightningDataModule, LightningModule, Trainer from pytorch_lightning.utilities import ( _NATIVE_AMP_AVAILABLE, @@ -384,6 +385,17 @@ def package_list_from_file(file): _TPU_AVAILABLE, ) _TORCHVISION_AVAILABLE = importlib.util.find_spec("torchvision") is not None +======= +from pytorch_lightning import LightningModule, Trainer +from pytorch_lightning.utilities import ( + NATIVE_AMP_AVAILABLE, + APEX_AVAILABLE, + XLA_AVAILABLE, + TPU_AVAILABLE, + _module_available, +) +TORCHVISION_AVAILABLE = _module_available("torchvision") +>>>>>>> d71659b4 (Fix docs typo (#4930)) """ coverage_skip_undoc_in_source = True diff --git a/docs/source/starter/style_guide.rst b/docs/source/starter/style_guide.rst index 54611a1d48290a..f922d900f80910 100644 --- a/docs/source/starter/style_guide.rst +++ b/docs/source/starter/style_guide.rst @@ -35,16 +35,16 @@ A LightningModule can define both a system and a model. Here's a LightningModule that defines a model: -.. code-block:: python +.. testcode:: - class LitModel(pl.LightningModule): - def __init__(self, num_layers: int = 3) + class LitModel(LightningModule): + def __init__(self, num_layers: int = 3): super().__init__() - self.layer_1 = nn.Linear(...) - self.layer_2 = nn.Linear(...) - self.layer_3 = nn.Linear(...) + self.layer_1 = nn.Linear() + self.layer_2 = nn.Linear() + self.layer_3 = nn.Linear() -Here's a lightningModule that defines a system: +Here's a LightningModule that defines a system: .. testcode:: diff --git a/pytorch_lightning/core/lightning.py b/pytorch_lightning/core/lightning.py index 0957b0af2b61e2..90cd9e37c09b2c 100644 --- a/pytorch_lightning/core/lightning.py +++ b/pytorch_lightning/core/lightning.py @@ -1522,7 +1522,7 @@ def save_hyperparameters(self, *args, frame=None) -> None: Args: args: single object of `dict`, `NameSpace` or `OmegaConf` - or string names or argumenst from class `__init__` + or string names or arguments from class `__init__` >>> class ManuallyArgsModel(LightningModule): ... def __init__(self, arg1, arg2, arg3):