Missed TensorFlow World? Check out the recap. Learn more

tff.simulation.datasets.build_single_label_dataset

View source on GitHub

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.

Args:

  • dataset: the base 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.

Returns:

A tf.data.Dataset that is composed of only examples that have a label matching desired_label.