Skip to content
Closed
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
5 changes: 5 additions & 0 deletions python/paddle/io/dataloader/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -693,6 +693,8 @@ def cumsum(sequence: Sequence[Any]) -> list[int]:
return r

def __init__(self, datasets: Iterable[Dataset[Any]]) -> None:
from paddle.utils.data import IterableDataset as UtilsIterableDataset

self.datasets = list(datasets)
assert len(self.datasets) > 0, (
'datasets should not be an empty iterable'
Expand All @@ -701,6 +703,9 @@ def __init__(self, datasets: Iterable[Dataset[Any]]) -> None:
assert not isinstance(d, IterableDataset), (
"ConcatDataset does not support IterableDataset"
)
assert not isinstance(d, UtilsIterableDataset), (
"ConcatDataset does not support IterableDataset"
)
self.cumulative_sizes = self.cumsum(self.datasets)

def __len__(self) -> int:
Expand Down
1 change: 1 addition & 0 deletions python/paddle/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
from ..base.framework import require_version
from . import ( # noqa: F401
cpp_extension,
data,
decorator_utils,
dlpack,
download,
Expand Down
17 changes: 17 additions & 0 deletions python/paddle/utils/data/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) 2026 PaddlePaddle Authors. All Rights Reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from .dataset import ConcatDataset, Dataset, IterableDataset

__all__ = ['ConcatDataset', 'Dataset', 'IterableDataset']
Loading
Loading