【PaddlePaddle Hackathon】31. 为 Paddle Inference 添加新的前端语言 #37160
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
PR types
New features
PR changes
为 Paddle Inference 添加 Java Apis
Describe
Task: #35977
Paddle Inference java API
Paddle Inference java API 基于 capi 和 jni 实现,需要您提前准备好C预测库。
安装
1.下载C预测库
您可以选择直接下载paddle_inference_c预测库,或通过源码编译的方式安装,源码编译方式参考官网文档,注意这里cmake编译时打开
-DON_INFER=ON
,在编译目录下得到paddle_inference_c_install_dir
。2.准备预测部署模型
下载 resnet50 模型后解压,得到 Paddle Combined 形式的模型。
3.准备预测执行目录
3. 编译动态链接库和jar包
5.运行单测,验证
在Java中使用Paddle预测
首先创建预测配置
创建predictor
获取输入Tensor
设置输入数据(假设只有一个输入)
运行预测
获取输出Tensor