# tff.simulation.datasets.build_single_label_dataset

<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/federated/blob/v0.87.0 Version 2.0, January 2004 Licensed under the Apache License, Version 2.0 (the) |

Build a new dataset that only yields examples with a particular label.

    tff.simulation.datasets.build_single_label_dataset(
        dataset, label_key, desired_label
    )

This can be used for creating pathological non-iid (in label space) datasets.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `dataset` | The base [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) that yields examples that are structures of string key -\> tensor value pairs. |
| `label_key` | The `str` key that holds the label for the example. |
| `desired_label` | The label value to restrict the resulting dataset to. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| A [`tf.data.Dataset`](https://www.tensorflow.org/api_docs/python/tf/data/Dataset) that is composed of only examples that have a label matching `desired_label`. ||

<br />