KeyError:“无法打开对象(对象'examples'不存在)”

问题描述 投票:0回答:1

我想像emnsit一样创建HDF5ClientData实例时收到此错误。这是我的代码:

TestNIST = tff.simulation.hdf5_client_data.HDF5ClientData("mynist.hdf5")

而且我之前已经在mynist.hdf5中添加了一些数据。我不知道为什么会发生。

the instance of emnist

这是我的错误,例如:

KeyError                                  Traceback (most recent call last)
<ipython-input-169-00a78fdc8682> in <module>()
----> 1 TestNIST = tff.simulation.hdf5_client_data.HDF5ClientData("mynist.hdf5")

1 frames
h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

/usr/local/lib/python3.6/dist-packages/h5py/_hl/group.py in __getitem__(self, name)
    262 
    263         Named HDF5 object (Dataset, Group, Datatype)
--> 264             A hard link is created at "name" which points to the
    265             given object.
    266 

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/_objects.pyx in h5py._objects.with_phil.wrapper()

h5py/h5o.pyx in h5py.h5o.open()

KeyError: "Unable to open object (object 'examples' doesn't exist)"
tensorflow hdf5 tensorflow-federated
1个回答
0
投票

哦,我知道为什么会发生此错误。我再次阅读了hdf5_client_data.py的符号,发现了这一点:此类期望HDF5文件具有顶级组examples,该组包含其他子组,每个子组一个,由用户ID命名。我的高层未命名为“示例”。

© www.soinside.com 2019 - 2024. All rights reserved.