Created by: tensor-tang
According to @Superjomn 's suggestion, the usage should be like this:
auto main_predictor = CreatePaddlePredictor(config);
std::vector<std::thread> threads;
for (size_t i = 0; i < num_threads; ++i) {
threads.emplace_back([&, i](
// clone a predictor which is thread-safe
// and shared the same parameters
auto predictor = main_predictor->Clone();
// prepare inputs and output ...
predictor->Run(inputs, outputs);
));
}
// join...
So, we should only focus on thread-safe and sharing parameters.