0

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

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

我之前在 mynist.hdf5 中添加了一些数据。我不知道为什么会这样。

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)"
4

1 回答 1

0

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

于 2020-04-06T07:29:25.970 回答