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

CAPI如何获取预测结果 #8885

Closed
yeyupiaoling opened this issue Mar 8, 2018 · 4 comments
Closed

CAPI如何获取预测结果 #8885

yeyupiaoling opened this issue Mar 8, 2018 · 4 comments
Assignees
Labels
User 用于标记用户问题

Comments

@yeyupiaoling
Copy link
Contributor

看到例子,下面代码就是最后的了,应该是预测的结果获取

CHECK(paddle_matrix_get_row(prob, 0, &array));
printf("Prob: \n");
for (int i = 0; i < height * width; ++i) {
printf("%.4f ", array[i]);
if ((i + 1) % width == 0) {
printf("\n");
}
}
printf("\n");

而使用Python的,预测的代码是下面这一条,所以cpp中的array是不是就是Python中的probs

probs = paddle.infer(output_layer=predict, parameters=parameters, input=test_data)
@ranqiu92 ranqiu92 added the User 用于标记用户问题 label Mar 8, 2018
@wangkuiyi
Copy link
Collaborator

@yeyupiaoling 是不是在用 Fluid 训练模型,同时寻求 inference 的做法?

我理解如果是Fluid训练的模型,可能就不能用这个被称为 C-API 的inference library来做inference了,而需要使用 Fluid 的inference 方法。请 @Xreki @kexinzhao 确认一下吧。我们也是有Fluid 的inference 的例子的。

@yeyupiaoling
Copy link
Contributor Author

@wangkuiyi
您好,我不是使用Fluid的,是使用Paddle 1的,然后编译放到Android上的,官方有个例子,我有几个问题不懂

@wangkuiyi
Copy link
Collaborator

哦。这个可能得 @Xreki 帮着看看呢。

@yeyupiaoling
Copy link
Contributor Author

yeyupiaoling commented Mar 16, 2018

CHECK(paddle_matrix_get_row(prob, 0, &array));

通过这一行就可以获得的array

    probs = paddle.infer(
        output_layer=out, parameters=parameters, input=test_data)

获得同样的结果。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
User 用于标记用户问题
Projects
None yet
Development

No branches or pull requests

5 participants