diff --git a/datasets/doc/source/tutorial-quickstart.ipynb b/datasets/doc/source/tutorial-quickstart.ipynb index d0f37ed311dd..ca6700aa31a3 100644 --- a/datasets/doc/source/tutorial-quickstart.ipynb +++ b/datasets/doc/source/tutorial-quickstart.ipynb @@ -439,6 +439,36 @@ "dataloader = DataLoader(partition_torch, batch_size=64)" ] }, + { + "cell_type": "markdown", + "id": "b93678a5", + "metadata": {}, + "source": "The `Dataloader` created this way does not return a `Tuple` when iterating over it but a `Dict` with the names of the columns as keys and features as values. Look below for an example." + }, + { + "cell_type": "code", + "execution_count": null, + "id": "5edd3ce2", + "metadata": {}, + "outputs": [ + { + "name": "stdout", + "output_type": "stream", + "text": [ + "Return type when iterating over dataloader: \n", + "torch.Size([64, 3, 32, 32])\n", + "torch.Size([64])\n" + ] + } + ], + "source": [ + "for batch in dataloader:\n", + " print(f\"Return type when iterating over a dataloader: {type(batch)}\")\n", + " print(batch[\"img\"].shape)\n", + " print(batch[\"label\"].shape)\n", + " break" + ] + }, { "cell_type": "markdown", "id": "71531613", diff --git a/datasets/flwr_datasets/federated_dataset.py b/datasets/flwr_datasets/federated_dataset.py index ecdaa1653e12..e913b9095d17 100644 --- a/datasets/flwr_datasets/federated_dataset.py +++ b/datasets/flwr_datasets/federated_dataset.py @@ -54,9 +54,11 @@ class FederatedDataset: no operation is applied. partitioners : Dict[str, Union[Partitioner, int]] A dictionary mapping the Dataset split (a `str`) to a `Partitioner` or an `int` - (representing the number of IID partitions that this split should be partitioned - into). One or multiple `Partitioner` objects can be specified in that manner, - but at most, one per split. + (representing the number of IID partitions that this split should be + partitioned into, i.e., using the default partitioner + `IidPartitioner `_). One or multiple `Partitioner` + objects can be specified in that manner, but at most, one per split. shuffle : bool Whether to randomize the order of samples. Applied prior to preprocessing operations, speratelly to each of the present splits in the dataset. It uses