提交 90f3a421 编写于 作者: L Liu Yiqun

Change the argument's type from reference to pointer.

上级 2d1d677e
...@@ -23,8 +23,8 @@ limitations under the License. */ ...@@ -23,8 +23,8 @@ limitations under the License. */
void ThreadedRunInference( void ThreadedRunInference(
const std::unique_ptr<paddle::framework::ProgramDesc>& inference_program, const std::unique_ptr<paddle::framework::ProgramDesc>& inference_program,
const paddle::framework::Executor& executor, paddle::framework::Executor* executor, paddle::framework::Scope* scope,
paddle::framework::Scope* scope, const int thread_id, const int thread_id,
const std::vector<paddle::framework::LoDTensor*>& cpu_feeds, const std::vector<paddle::framework::LoDTensor*>& cpu_feeds,
const std::vector<paddle::framework::LoDTensor*>& cpu_fetchs) { const std::vector<paddle::framework::LoDTensor*>& cpu_fetchs) {
auto copy_program = std::unique_ptr<paddle::framework::ProgramDesc>( auto copy_program = std::unique_ptr<paddle::framework::ProgramDesc>(
...@@ -56,8 +56,8 @@ void ThreadedRunInference( ...@@ -56,8 +56,8 @@ void ThreadedRunInference(
} }
// 6. Run the inference program // 6. Run the inference program
executor.Run(*copy_program, scope, feed_targets, fetch_targets, executor->Run(*copy_program, scope, feed_targets, fetch_targets,
feed_holder_name, fetch_holder_name); feed_holder_name, fetch_holder_name);
} }
template <typename Place> template <typename Place>
...@@ -78,8 +78,8 @@ void TestMultiThreadInference( ...@@ -78,8 +78,8 @@ void TestMultiThreadInference(
std::vector<std::thread*> threads; std::vector<std::thread*> threads;
for (int i = 0; i < num_threads; ++i) { for (int i = 0; i < num_threads; ++i) {
threads.push_back(new std::thread( threads.push_back(new std::thread(
ThreadedRunInference, std::ref(inference_program), std::ref(executor), ThreadedRunInference, std::ref(inference_program), &executor, scope, i,
scope, i, std::ref(cpu_feeds[i]), std::ref(cpu_fetchs[i]))); std::ref(cpu_feeds[i]), std::ref(cpu_fetchs[i])));
} }
for (int i = 0; i < num_threads; ++i) { for (int i = 0; i < num_threads; ++i) {
threads[i]->join(); threads[i]->join();
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册