From 1b10ccdb78321851f7685e125fe49ca66c4b7222 Mon Sep 17 00:00:00 2001 From: wuhuanzhou Date: Wed, 2 Jun 2021 10:48:50 +0800 Subject: [PATCH] fix iScan C++ problems, test=develop (#33274) --- paddle/fluid/operators/math/concat_test.cc | 2 ++ paddle/fluid/operators/math/math_function_test.cc | 2 ++ paddle/fluid/operators/math/vol2col_test.cc | 3 +++ paddle/fluid/operators/scatter_test.cc | 2 ++ 4 files changed, 9 insertions(+) diff --git a/paddle/fluid/operators/math/concat_test.cc b/paddle/fluid/operators/math/concat_test.cc index 011c85caf04..c8e2acea451 100644 --- a/paddle/fluid/operators/math/concat_test.cc +++ b/paddle/fluid/operators/math/concat_test.cc @@ -437,6 +437,8 @@ void TestConcatMain() { ConcatCase2(context); ConcatCase3(context); ConcatCase4(context); + + delete context; } TEST(math, concat) { diff --git a/paddle/fluid/operators/math/math_function_test.cc b/paddle/fluid/operators/math/math_function_test.cc index 3388d7edafe..32f9938dcac 100644 --- a/paddle/fluid/operators/math/math_function_test.cc +++ b/paddle/fluid/operators/math/math_function_test.cc @@ -208,6 +208,7 @@ void GemvTest(int m, int n, bool trans) { ASSERT_FLOAT_EQ(data_c[i], sum); } } + delete cpu_place; } TEST(math_function, gemv) { @@ -274,6 +275,7 @@ void GemmWarpTest(int m, int n, int k, T alpha, T beta) { for (int i = 0; i < mat_c_mkl.numel(); ++i) { EXPECT_FLOAT_EQ(CREF[i], CMKL[i]); } + delete cpu_place; } TEST(math_function, gemm_warp) { diff --git a/paddle/fluid/operators/math/vol2col_test.cc b/paddle/fluid/operators/math/vol2col_test.cc index cc3b838cbcf..5a8e7fcc2a7 100644 --- a/paddle/fluid/operators/math/vol2col_test.cc +++ b/paddle/fluid/operators/math/vol2col_test.cc @@ -116,6 +116,9 @@ void testVol2col() { for (int i = 0; i < 12; ++i) { EXPECT_EQ(in_ptr[i], col_2_vol[i]); } + + delete place; + delete context; } TEST(math, vol2col) { diff --git a/paddle/fluid/operators/scatter_test.cc b/paddle/fluid/operators/scatter_test.cc index c83726180ba..f94fce66806 100644 --- a/paddle/fluid/operators/scatter_test.cc +++ b/paddle/fluid/operators/scatter_test.cc @@ -54,4 +54,6 @@ TEST(scatter, ScatterUpdate) { EXPECT_EQ(output.data()[i], static_cast(i - 4)); for (size_t i = 8; i < 16; ++i) EXPECT_EQ(p_output[i], 0.0f); for (size_t i = 8; i < 16; ++i) EXPECT_EQ(output.data()[i], 0.0f); + + delete cpu_place; } -- GitLab