我使用稳定版本的tff使用tff.simulation.FromTensorSlicesClientData(client_train_dataset)来创建客户端数据,它工作得很好。我不得不每晚切换到tff,现在调用它会给我一个错误:
AttributeError: module 'tensorflow_federated.python.simulation' has no attribute 'FromTensorSlicesClientData'下面是我的代码中抛出错误的部分:
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)我应该用不同的方式来做这件事吗?
发布于 2021-04-18 23:03:07
在commit #1def433中将tff.simulation.TensorSlicesClientData重命名为tff.simulation.datasets.TestClientData。这已经包含在夜间版本中,并将包含在下一个编号版本中。
https://stackoverflow.com/questions/67147951
复制相似问题