我对Keras很新。我有五个保存的模型(通过tensorflow后端),当我用(load_model)加载它们时,每个模型加载需要20秒以上。我试图使进程并行,以便每个model_load可以由不同的核心处理。在这里我尝试过:
from multiprocessing.pool import ThreadPool
pool = ThreadPool(processes=5)
pool.map(loadf, (filename for filename in ['model1.h5', 'model2.h5','model3.h5','model4.h5','model5.h5']))
pool.close()
它会抛出以下错误:
...
TypeError: Cannot interpret feed_dict key as Tensor: Tensor Tensor("Placeholder:0", shape=(43, 80), dtype=float32) is not an element of this graph.
如何将这5个模型分别加载到不同的核心中?