I am currently trying to save a list of numpy arrays into a single file, an example of such a list can be of the form below
import numpy as np
np_list = []
for i in range(10):
if i % 2 == 0:
np_list.append(np.random.randn(64))
else:
np_list.append(np.random.randn(32, 64))
I can combine all of them using into a single file using savez
by iterating through list but is there any other way? I am trying to save weights returned by the function model.get_weights()
, which is a list of ndarray
and after retrieving the weights from the saved file I intend to load those weights into another model using model.set_weights(np_list)
. Therefore the format of the list must remain the same. Let me know if anyone has an elegant way of doing this.