From 8d0266f958c8ae93c1227eefb377ab5b42784552 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mochol=C3=AD?= Date: Wed, 25 May 2022 16:38:39 +0200 Subject: [PATCH] Fix doctests --- docs/source/starter/core_guide.rst | 32 ++++++------------------------ 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/docs/source/starter/core_guide.rst b/docs/source/starter/core_guide.rst index 42bb74290c..02fa95b180 100644 --- a/docs/source/starter/core_guide.rst +++ b/docs/source/starter/core_guide.rst @@ -1,9 +1,3 @@ -.. testsetup:: * - - from pytorch_lightning.core.lightning import LightningModule - from pytorch_lightning.core.datamodule import LightningDataModule - from pytorch_lightning.trainer.trainer import Trainer - .. _introduction_guide: ######################### @@ -72,7 +66,7 @@ Let's first start with the model. In this case, we'll design a 3-layer neural ne import torch from torch.nn import functional as F from torch import nn - from pytorch_lightning.core.lightning import LightningModule + from pytorch_lightning import LightningModule class LitMNIST(LightningModule): @@ -187,14 +181,13 @@ Data Lightning operates on pure dataloaders. Here's the PyTorch code for loading MNIST. -.. testcode:: - :skipif: not _TORCHVISION_AVAILABLE +.. code-block:: python - from torch.utils.data import DataLoader, random_split - from torchvision.datasets import MNIST import os - from torchvision import datasets, transforms - from pytorch_lightning import Trainer + + from torch.utils.data import DataLoader + from torchvision import transforms + from torchvision.datasets import MNIST # transforms # prepare transforms standard to MNIST @@ -204,19 +197,6 @@ Lightning operates on pure dataloaders. Here's the PyTorch code for loading MNIS mnist_train = MNIST(os.getcwd(), train=True, download=True, transform=transform) mnist_train = DataLoader(mnist_train, batch_size=64) -.. testoutput:: - :hide: - :skipif: os.path.isdir(os.path.join(os.getcwd(), 'MNIST')) or not _TORCHVISION_AVAILABLE - - Downloading ... - Extracting ... - Downloading ... - Extracting ... - Downloading ... - Extracting ... - Processing... - Done! - You can use DataLoaders in three ways: 1. Pass DataLoaders to .fit()