Loads a number of datasets from the dataset collection. Args: datasets: dataset names to load. split: which split(s) of the datasets to load. loader_kwargs: keyword arguments to be passed to the `tfds.load` function. Refer to `tfds.load` documentation for a comperehens
(
self,
datasets: Iterable[str],
split: Optional[Tree[splits_lib.SplitArg]] = None,
loader_kwargs: dict[str, Any] | None = None,
)
| 383 | return loaded_datasets # pytype: disable=bad-return-type |
| 384 | |
| 385 | def load_datasets( |
| 386 | self, |
| 387 | datasets: Iterable[str], |
| 388 | split: Optional[Tree[splits_lib.SplitArg]] = None, |
| 389 | loader_kwargs: dict[str, Any] | None = None, |
| 390 | ) -> Mapping[str, Mapping[str, tf.data.Dataset]]: |
| 391 | """Loads a number of datasets from the dataset collection. |
| 392 | |
| 393 | Args: |
| 394 | datasets: dataset names to load. |
| 395 | split: which split(s) of the datasets to load. |
| 396 | loader_kwargs: keyword arguments to be passed to the `tfds.load` function. |
| 397 | Refer to `tfds.load` documentation for a comperehensive overview of the |
| 398 | different loading options. |
| 399 | |
| 400 | Returns: |
| 401 | mapping between a dataset name and a mapping of split name to |
| 402 | tf.data.Dataset for each requested dataset. |
| 403 | |
| 404 | Raises: |
| 405 | ValueError: if no dataset(s) to load are given. |
| 406 | """ |
| 407 | if not datasets: |
| 408 | raise ValueError('At least one dataset should be specified.') |
| 409 | return { |
| 410 | dataset_name: self.load_dataset( |
| 411 | dataset_name, split=split, loader_kwargs=loader_kwargs |
| 412 | ) |
| 413 | for dataset_name in datasets |
| 414 | } |
| 415 | |
| 416 | def load_all_datasets( |
| 417 | self, |
no test coverage detected