'tensorflow_federated.python.simulation' 在使用 tff-nightly 时没有属性 'FromTensorSlicesClientData' [英] 'tensorflow_federated.python.simulation' has no attribute 'FromTensorSlicesClientData' when using tff-nightly

查看:79
本文介绍了'tensorflow_federated.python.simulation' 在使用 tff-nightly 时没有属性 'FromTensorSlicesClientData'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 tff.simulation.FromTensorSlicesClientData(client_train_dataset) 使用稳定版本的 tff 创建客户端数据,并且运行良好.我不得不切换到 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)

我应该换一种方式吗?

推荐答案

tff.simulation.TensorSlicesClientData 更名为 tff.simulation.datasets.TestClientData 在提交 #1def433.这已经包含在每晚发布的版本中,并将包含在下一个编号版本中.

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.

这篇关于'tensorflow_federated.python.simulation' 在使用 tff-nightly 时没有属性 'FromTensorSlicesClientData'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆