Paddle预测API无法加载多个network
Created by: rulai-huajunzeng
想在同一程序里用预测API加载多个network,类似这样:
for idx in range(n):
conf = parse_config(train_conf[idx], "is_predict=1")
network[idx] = swig_paddle.GradientMachine.createFromConfigProto(conf.model_config)
network[idx].loadParameters(model_dir)
只加载一个网络时程序没错。有多个网络时,loadParameters这里出错了,出错信息是,
Parameter.cpp:350] _lstm_transform___bidirectional_lstm_2___fw.w0 missing, not allowed.
程序里只有两个blstm,只有0和1两套参数。估计是用了全局变量来累计给layer命名。有没有什么解决办法?