tensorflowtensorflow-federated

'tensorflow_federated.python.simulation' has no attribute 'FromTensorSlicesClientData' when using tff-nightly


I was using tff.simulation.FromTensorSlicesClientData(client_train_dataset) to create client's data with the stable version of tff, and it was working fine. I had to switch to tff-nightly, and now calling this gives me an error:

AttributeError: module 'tensorflow_federated.python.simulation' has no attribute 'FromTensorSlicesClientData'

Here's the section of my code, where the error is thrown:

total_clients = 3
total_samples = len(x_train)
samples_per_set = int(np.floor(total_samples/total_clients))

client_train_dataset = collections.OrderedDict()
for i in range(1, total_clients+1):
  client_name = "client_" + str(i)
  start = samples_per_set * (i-1)
  end = samples_per_set * i
  data = collections.OrderedDict((('y', y_train[start:end]), ('x', x_train[start:end])))
  client_train_dataset[client_name] = data

train_dataset = tff.simulation.FromTensorSlicesClientData(client_train_dataset)

Should I be doing this a different way?


Solution

  • tff.simulation.TensorSlicesClientData was renamed to tff.simulation.datasets.TestClientData in commit #1def433. This included in the nightly release already and will be included in the next numbered release.