tff.simulation.HDF5ClientData

Class HDF5ClientData

Inherits From: ClientData

Defined in simulation/hdf5_client_data.py.

A tf.simulation.ClientData backed by an HDF5 file.

This class expects that the HDF5 file has a top-level group examples which contains further subgroups, one per user, named by the user ID.

The tf.data.Dataset returned by HDF5ClientData.create_tf_dataset_for_client(client_id) yields tuples from zipping all datasets that were found at /data/client_id group, in a similar fashion to tf.data.Dataset.from_tensor_slices().

__init__

__init__(hdf5_filepath)

Constructs a tf.simulation.ClientData object.

Args:

  • hdf5_filepath: String path to the hdf5 file.

Properties

client_ids

output_shapes

output_types

Methods

create_tf_dataset_for_client

create_tf_dataset_for_client(client_id)

create_tf_dataset_from_all_clients

create_tf_dataset_from_all_clients()

Creates a new tf.data.Dataset containing all client examples.

NOTE: the returned tf.data.Dataset is not serializable and runnable on other devices, as it uses tf.py_func internally.

Returns:

A tf.data.Dataset object.