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 inference example and unit-test for fit-a-line book chapter #8208

Merged
merged 7 commits into from
Feb 9, 2018

Conversation

kexinzhao
Copy link
Contributor

@kexinzhao kexinzhao commented Feb 7, 2018

fix #8201

@kexinzhao kexinzhao added the 预测 原名Inference,包含Capi预测问题等 label Feb 7, 2018
@kexinzhao kexinzhao requested review from sidgoyal78 and Xreki February 7, 2018 05:03

DEFINE_string(dirname, "", "Directory of the inference model.");

TEST(inference, label_semantic_roles) {
Copy link
Contributor

Choose a reason for hiding this comment

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

label_semantic_roles -> fit_a_line

// The second dim of the input tensor should be 13
// The input data should be >= 0
SetupTensor<float>(
input, {10, 13}, static_cast<float>(0), static_cast<float>(10));
Copy link
Contributor

Choose a reason for hiding this comment

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

Define a variable int64_t batch_size = 10, then use {batch_size, 13} here.


# The input's dimension should be 2-D and the second dim is 13
# The input data should be >= 0
tensor_x = numpy.random.uniform(0, 10, [10, 13]).astype("float32")
Copy link
Contributor

Choose a reason for hiding this comment

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

Same here. Define batch_size = 10, and use [batch_size, 13] here.

@Xreki
Copy link
Contributor

Xreki commented Feb 9, 2018

Need to update to the develop branch because the definition of TestInference is modified in #8227

Copy link
Contributor

@Xreki Xreki left a comment

Choose a reason for hiding this comment

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

LGTM

@Xreki Xreki merged commit 720994b into PaddlePaddle:develop Feb 9, 2018
@kexinzhao kexinzhao deleted the inf_fit_a_line branch April 4, 2018 02:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
预测 原名Inference,包含Capi预测问题等
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add inference unit-test for fit-a-line book chapter
2 participants