'tensorflow_federated.python.simulation' 在使用 tff-nightly 时没有属性 'FromTensorSlicesClientData'
'tensorflow_federated.python.simulation' has no attribute 'FromTensorSlicesClientData' when using tff-nightly
我使用 tff.simulation.FromTensorSlicesClientData(client_train_dataset)
通过 tff 的稳定版本创建客户端数据,并且工作正常。我不得不每晚切换到 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)
我应该换一种方式吗?
tff.simulation.TensorSlicesClientData
已重命名为 tff.simulation.datasets.TestClientData
in commit #1def433。这已包含在夜间版本中,并将包含在下一个编号版本中。
我使用 tff.simulation.FromTensorSlicesClientData(client_train_dataset)
通过 tff 的稳定版本创建客户端数据,并且工作正常。我不得不每晚切换到 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)
我应该换一种方式吗?
tff.simulation.TensorSlicesClientData
已重命名为 tff.simulation.datasets.TestClientData
in commit #1def433。这已包含在夜间版本中,并将包含在下一个编号版本中。