试图将新的数据集添加到h5py文件中,但出现以下错误,br />
提高TypeError(“只能调整分块的数据集的大小”))TypeError: 只有分块的数据集可以调整大小
with h5py.File(self.datapath, 'a') as hf:
print('original saliency shape->{}'.format(hf["saliencys"].shape))
hf["saliencys"].resize((hf["saliencys"].shape[0] + sal_maps.shape[0]))
hf['saliencys'][-sal_maps.shape[0]:] = sal_maps
hf['probs'].resize(hf['probs'].shape[0] + sal_maps.shape[0])
hf['probs'][-probs.shape[0]:] = probs
hf['preds'].resize(hf['preds'].shape[0] + preds.shape[0])
hf['preds'][-preds.shape[0]:] = preds
del sal_maps, probs, preds