Paddle icon indicating copy to clipboard operation
Paddle copied to clipboard

同时预测2个模型

Open aidlcnnlstm opened this issue 8 years ago • 1 comments

请问 如下的流程如何实现? paddle.init()

pred1=model1() pred2=model2()

res1 = paddle.infer(mode1) res2 = paddle.infer(mode2)

aidlcnnlstm avatar Jan 29 '18 12:01 aidlcnnlstm

@aiDLcnnLSTM 两个模型放在一起infer可能会有冲突,因为它们都会初始化一些不可见的全局变量。解决办法是在一个模型infer完成之后清空这些上下文,再执行另一个模型的infer,请参考 https://github.com/PaddlePaddle/Paddle/blob/develop/python/paddle/v2/tests/test_rnn_layer.py#L35

kuke avatar Jan 30 '18 03:01 kuke