Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add share_external_data interface demo #219

Merged
merged 4 commits into from
Feb 23, 2022

Conversation

JZZ-NOTE
Copy link
Contributor

添加 ShareExternalData 接口的 demo
使用说明:
用户可以通过 ShareExternalData 接口自己管理输入和输出的数据指针。在推理过程中,需要保证数据指针不发生改动;对于输出的数据,用户需要知道数据的shape和位置(CPU/GPU上)


for (size_t i = 0; i < out_data.size(); i += 100) {
LOG(INFO) << i << " : " << out_data[i] << std::endl;
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cudaFree.. free

// 参数:shape - 数据 shape
// 参数:place - 数据的存放位置
// 参数:layout - 数据格式,默认为 NCHW,当前仅支持 NCHW
// 返回:None
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注意事项:
1、输入的情况,用户保证输入指针数据预测过程中有效
2、输出的情况,用户保证输出指针的数据长度大于等于模型的输出数据size

}

for (size_t i = 0; i < FLAGS_warmup; ++i)
CHECK(predictor->Run());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

handle ShareExternalData之后才能run

Copy link
Contributor

@jiweibo jiweibo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@jiweibo jiweibo merged commit eee5f72 into PaddlePaddle:master Feb 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants