Skip to content

Commit 54a2b5c

Browse files
rschiremanRaymond G Schiremanrohitgr7akihironitta
authored
Remove the deprecated LightningDataModule.test_transforms (#12773)
Co-authored-by: Raymond G Schireman <[email protected]> Co-authored-by: Rohit Gupta <[email protected]> Co-authored-by: Akihiro Nitta <[email protected]>
1 parent c482ae3 commit 54a2b5c

File tree

3 files changed

+4
-30
lines changed

3 files changed

+4
-30
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,9 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).
121121
- Removed support for passing strategy names or strategy instances to the plugins Trainer argument ([#12700](https://github.com/PyTorchLightning/pytorch-lightning/pull/12700))
122122

123123

124+
- Removed the deprecated `test_transforms` argument from the `LightningDataModule` constructor ([#12773](https://github.com/PyTorchLightning/pytorch-lightning/pull/12773))
125+
126+
124127
- Removed deprecated `dataloader_idx` argument from `on_train_batch_start/end` hooks `Callback` and `LightningModule` ([#12769](https://github.com/PyTorchLightning/pytorch-lightning/pull/12769))
125128

126129
### Fixed

pytorch_lightning/core/datamodule.py

Lines changed: 1 addition & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -54,19 +54,13 @@ def teardown(self):
5454

5555
name: str = ...
5656

57-
def __init__(self, val_transforms=None, test_transforms=None):
57+
def __init__(self, val_transforms=None):
5858
super().__init__()
5959
if val_transforms is not None:
6060
rank_zero_deprecation(
6161
"DataModule property `val_transforms` was deprecated in v1.5 and will be removed in v1.7."
6262
)
63-
if test_transforms is not None:
64-
rank_zero_deprecation(
65-
"DataModule property `test_transforms` was deprecated in v1.5 and will be removed in v1.7."
66-
)
6763
self._val_transforms = val_transforms
68-
self._test_transforms = test_transforms
69-
7064
# Pointer to the trainer object
7165
self.trainer = None
7266

@@ -89,25 +83,6 @@ def val_transforms(self, t):
8983
)
9084
self._val_transforms = t
9185

92-
@property
93-
def test_transforms(self):
94-
"""Optional transforms (or collection of transforms) you can apply to test dataset.
95-
96-
.. deprecated:: v1.5 Will be removed in v1.7.0.
97-
"""
98-
99-
rank_zero_deprecation(
100-
"DataModule property `test_transforms` was deprecated in v1.5 and will be removed in v1.7."
101-
)
102-
return self._test_transforms
103-
104-
@test_transforms.setter
105-
def test_transforms(self, t):
106-
rank_zero_deprecation(
107-
"DataModule property `test_transforms` was deprecated in v1.5 and will be removed in v1.7."
108-
)
109-
self._test_transforms = t
110-
11186
@classmethod
11287
def add_argparse_args(cls, parent_parser: ArgumentParser, **kwargs) -> ArgumentParser:
11388
"""Extends existing argparse by default `LightningDataModule` attributes."""

tests/deprecated_api/test_remove_1-7.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,8 @@ def test_v1_7_0_datamodule_transform_properties(tmpdir):
4343
dm = MNISTDataModule()
4444
with pytest.deprecated_call(match=r"DataModule property `val_transforms` was deprecated in v1.5"):
4545
dm.val_transforms = "b"
46-
with pytest.deprecated_call(match=r"DataModule property `test_transforms` was deprecated in v1.5"):
47-
dm.test_transforms = "c"
4846
with pytest.deprecated_call(match=r"DataModule property `val_transforms` was deprecated in v1.5"):
4947
_ = LightningDataModule(val_transforms="b")
50-
with pytest.deprecated_call(match=r"DataModule property `test_transforms` was deprecated in v1.5"):
51-
_ = LightningDataModule(test_transforms="c")
5248

5349

5450
def test_v1_7_0_moved_get_progress_bar_dict(tmpdir):

0 commit comments

Comments
 (0)