Skip to content

Commit

Permalink
Remove the deprecated code in pl.utilities.apply_func (#16413)
Browse files Browse the repository at this point in the history
  • Loading branch information
carmocca committed Jan 19, 2023
1 parent efec150 commit b60c75e
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 130 deletions.
1 change: 0 additions & 1 deletion docs/source-pytorch/api_references.rst
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,6 @@ utilities
:toctree: api
:nosignatures:

apply_func
argparse
cloud_io
deepspeed
Expand Down
2 changes: 2 additions & 0 deletions src/pytorch_lightning/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/).

- Removed the deprecated code in `pl.utilities.distributed` ([#16390](https://github.com/Lightning-AI/lightning/pull/16390))

- Removed the deprecated code in `pl.utilities.apply_func` ([#16413](https://github.com/Lightning-AI/lightning/pull/16413))

- Removed the deprecated code in `pl.utilities.xla_device` ([#16404](https://github.com/Lightning-AI/lightning/pull/16404))

- Removed the deprecated code in `pl.utilities.device_parser` ([#16412](https://github.com/Lightning-AI/lightning/pull/16412))
Expand Down
92 changes: 0 additions & 92 deletions src/pytorch_lightning/utilities/apply_func.py

This file was deleted.

37 changes: 0 additions & 37 deletions tests/tests_pytorch/deprecated_api/test_remove_2-0.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
# See the License for the specific language governing permissions and
# limitations under the License.
"""Test deprecated functionality which will be removed in v2.0.0."""

import numpy
import pytest
import torch
from torch.utils.data import DataLoader
Expand All @@ -22,15 +20,6 @@
from pytorch_lightning.core.mixins.device_dtype_mixin import DeviceDtypeModuleMixin
from pytorch_lightning.demos.boring_classes import RandomDataset
from pytorch_lightning.strategies.utils import on_colab_kaggle
from pytorch_lightning.utilities.apply_func import (
apply_to_collection,
apply_to_collections,
convert_to_tensors,
from_numpy,
move_data_to_device,
to_dtype_tensor,
TransferableDataType,
)
from pytorch_lightning.utilities.cloud_io import atomic_save, get_filesystem, load
from pytorch_lightning.utilities.data import has_iterable_dataset, has_len
from pytorch_lightning.utilities.optimizer import optimizer_to_device, optimizers_to_device
Expand All @@ -50,32 +39,6 @@ class MyModule(DeviceDtypeModuleMixin):
MyModule()


def test_v1_10_deprecated_apply_func_utilities():
with pytest.deprecated_call(match="apply_func.apply_to_collection` has been deprecated in v1.8.0"):
apply_to_collection([], dtype=object, function=(lambda x: x))

with pytest.deprecated_call(match="apply_func.apply_to_collections` has been deprecated in v1.8.0"):
apply_to_collections([], [], dtype=object, function=(lambda x, y: x))

with pytest.deprecated_call(match="apply_func.convert_to_tensors` has been deprecated in v1.8.0"):
convert_to_tensors([], torch.device("cpu"))

with pytest.deprecated_call(match="apply_func.from_numpy` has been deprecated in v1.8.0"):
from_numpy(numpy.zeros(2), torch.device("cpu"))

with pytest.deprecated_call(match="apply_func.move_data_to_device` has been deprecated in v1.8.0"):
move_data_to_device(torch.tensor(2), torch.device("cpu"))

with pytest.deprecated_call(match="apply_func.to_dtype_tensor` has been deprecated in v1.8.0"):
to_dtype_tensor(torch.tensor(2), dtype=torch.float32, device=torch.device("cpu"))

class MyModule(TransferableDataType):
pass

with pytest.deprecated_call(match="apply_func.TransferableDataType` has been deprecated in v1.8.0"):
MyModule()


def test_v1_10_deprecated_cloud_io_utilities(tmpdir):
with pytest.deprecated_call(match="cloud_io.atomic_save` has been deprecated in v1.8.0"):
atomic_save({}, tmpdir / "atomic_save.ckpt")
Expand Down

0 comments on commit b60c75e

Please sign in to comment.