Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Data] Deprecate iter_tf_batches #48693

Merged
merged 2 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions doc/source/data/api/dataset.rst
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,14 @@ Developer API
block.BlockExecStats
block.BlockMetadata
block.BlockAccessor

Deprecated API
--------------

.. currentmodule:: ray.data

.. autosummary::
:nosignatures:
:toctree: doc/

Dataset.iter_tf_batches
7 changes: 6 additions & 1 deletion python/ray/data/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4018,7 +4018,7 @@ def iter_torch_batches(
)

@ConsumptionAPI
@PublicAPI(api_group=CD_API_GROUP)
@Deprecated
def iter_tf_batches(
self,
*,
Expand Down Expand Up @@ -4091,6 +4091,11 @@ def iter_tf_batches(
:meth:`Dataset.iter_batches`
Call this method to manually convert your data to TensorFlow tensors.
""" # noqa: E501
warnings.warn(
"`iter_tf_batches` is deprecated and will be removed after May 2025. Use "
"`to_tf` instead.",
DeprecationWarning,
)
return self.iterator().iter_tf_batches(
prefetch_batches=prefetch_batches,
batch_size=batch_size,
Expand Down
5 changes: 5 additions & 0 deletions python/ray/data/tests/test_consumption.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,6 +1259,11 @@ def test_union(ray_start_regular_shared):
assert ds2.count() == 210


def test_iter_tf_batches_emits_deprecation_warning(ray_start_regular_shared):
with pytest.warns(DeprecationWarning):
ray.data.range(1).iter_tf_batches()


@pytest.mark.skipif(
sys.version_info >= (3, 12), reason="No tensorflow for Python 3.12+"
)
Expand Down
Loading