How to create a HDF5 dataset when size of one dimension of a multidimensional array is not fixed. I tried the following toy code, but it seems that I am missing some point here.
import numpy as np
import h5py
Polyline=h5py.special_dtype(vlen=np.float32)
f=h5py.File('dataset.hdf5', mode='w')
var_features=f.create_dataset('var_features', (10,), dtype=Polyline )
features = np.empty(shape=(10,), dtype=Polyline)
for i in range(10):
a=10+i*2
features[i]=np.arange(a).reshape(a/2,2)
var_features[...]=features
print features[0].shape
print var_features[0].shape