Convert h5py Dataset to np.array before preprocess_weights_for_loading
@@ -3370,7 +3370,7 @@ def load_weights_from_hdf5_group(f, layers, reshape=False):
for k, name in enumerate(layer_names):
g = f[name]
weight_names = _load_attributes_from_hdf5_group(g, 'weight_names')
- weight_values = [g[weight_name] for weight_name in weight_names]
+ weight_values = [np.asarray(g[weight_name]) for weight_name in weight_names]
layer = filtered_layers[k]
symbolic_weights = layer.weights
weight_values = preprocess_weights_for_loading(layer,
@@ -3438,7 +3438,7 @@ def load_weights_from_hdf5_group_by_name(f, layers, skip_mismatch=False,
for k, name in enumerate(layer_names):
g = f[name]
weight_names = _load_attributes_from_hdf5_group(g, 'weight_names')
- weight_values = [g[weight_name] for weight_name in weight_names]
+ weight_values = [np.asarray(g[weight_name]) for weight_name in weight_names]
for layer in index.get(name, []):
symbolic_weights = layer.weights
