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

Fix ContextProjectionOpTest #1824

Merged
merged 2 commits into from
Apr 20, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 15 additions & 13 deletions paddle/function/ContextProjectionOpTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ void testMatrixProjectionForward(int context_start,
std::max(0, (int)(context_start + context_length - 1));
if (pad == 0) is_padding = false;

FunctionCompare test("ContextProjectionForward",
FuncConfig()
.set("context_length", context_length)
.set("context_start", context_start)
.set("begin_pad", std::max(0, -context_start)));
FunctionCompare test(
"ContextProjectionForward",
FuncConfig()
.set("context_length", context_length)
.set("context_start", context_start)
.set("begin_pad", (size_t)std::max(0, -context_start)));

// prepare input arguments
test.addSequence(SequenceIdArg(TensorShape{batch_size}));
Expand All @@ -51,21 +52,22 @@ void testMatrixProjectionForward(int context_start,
}

void testMatrixProjectionBackward(int context_start,
int context_length,
size_t context_length,
bool is_padding,
size_t batch_size,
size_t input_dim) {
size_t pad = std::max(0, -context_start) +
std::max(0, (int)(context_start + context_length - 1));
if (pad == 0) is_padding = false;

FunctionCompare test("ContextProjectionBackward",
FuncConfig()
.set("context_length", context_length)
.set("context_start", context_start)
.set("begin_pad", std::max(0, -context_start))
.set("is_padding", is_padding)
.set("total_pad", pad));
FunctionCompare test(
"ContextProjectionBackward",
FuncConfig()
.set("context_length", context_length)
.set("context_start", context_start)
.set("begin_pad", (size_t)std::max(0, -context_start))
.set("is_padding", is_padding)
.set("total_pad", pad));

// prepare input arguments
test.addSequence(SequenceIdArg(TensorShape{batch_size}));
Expand Down
4 changes: 3 additions & 1 deletion paddle/math/tests/test_matrixCompare.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,10 @@ TEST(Matrix, unary) {
testMatrixTranspose(height, width);
testMatrixRotate(height, width);
}
// inverse
// inverse
#ifdef PADDLE_USE_LAPACK
testMatrixInverse(height);
#endif
}
}

Expand Down