在h5py中,什么是类型“|O”?

2024-02-08

调试使用 h5py 的程序。 hdf5 应该看起来像这样:

test.hdf5
    -labels <- DataSet
    -train <- Group

I do:

>>> import h5py
>>> test = h5py.File('test.hdf5')
>>> test['labels']
<HDF5 dataset "labels": shape (1, 2), type "|O">

什么是类型|O?我在 上找不到它类型列表 http://docs.h5py.org/en/latest/faq.html?highlight=%22%7CO%22 or the 特殊类型 http://docs.h5py.org/en/latest/special.html#vlen.


It's a 参考 http://docs.h5py.org/en/latest/refs.html#storing-references-in-a-dataset.

实现该部分中的示例:

In [275]: import h5py
In [276]: ref_dtype = h5py.special_dtype(ref=h5py.Reference)
In [278]: ref_dtype
Out[278]: dtype('O')

In [279]: f=h5py.File('test.h5','w')
In [281]: ref_dataset = f.create_dataset("MyRefs", (100,), dtype=ref_dtype)
In [282]: ref_dataset
Out[282]: <HDF5 dataset "MyRefs": shape (100,), type "|O">
In [283]: ref_dataset[:].dtype
Out[283]: dtype('O')
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

在h5py中,什么是类型“|O”? 的相关文章

随机推荐