Provide backward compatibility for #124 (#400)

* Provide backward compatibility for e681253

* typo fix
This commit is contained in:
tamyiuchau
2019-10-21 08:16:55 +02:00
committed by William Falcon
parent 67f6e7bb19
commit 4103a5ca73
2 changed files with 43 additions and 1 deletions
+19 -1
View File
@@ -7,6 +7,8 @@ from pytorch_lightning.root_module.model_saving import ModelIO
from pytorch_lightning.root_module.hooks import ModelHooks
from pytorch_lightning.root_module.decorators import data_loader
import warnings
class LightningModule(GradInformation, ModelIO, ModelHooks):
@@ -110,13 +112,29 @@ class LightningModule(GradInformation, ModelIO, ModelHooks):
# clear gradients
optimizer.zero_grad()
@data_loader
def tng_dataloader(self):
"""
Implement a PyTorch DataLoader
* Deprecated in v0.5.0. use train_dataloader instead. *
:return:
"""
raise NotImplementedError
@data_loader
def train_dataloader(self):
"""
Implement a PyTorch DataLoader
:return:
"""
raise NotImplementedError
#
try:
output = self.tng_dataloader()
warnings.warn("tng_dataloader has been renamed to train_dataloader since v0.5.0",
DeprecationWarning)
return output
except NotImplementedError:
raise NotImplementedError
@data_loader
def test_dataloader(self):