提交 c33664c8 编写于 作者: J jiweibo

fix unit test.

上级 6b727e08
...@@ -15,6 +15,7 @@ limitations under the License. */ ...@@ -15,6 +15,7 @@ limitations under the License. */
#include <gflags/gflags.h> #include <gflags/gflags.h>
#include <glog/logging.h> #include <glog/logging.h>
#include <gtest/gtest.h> #include <gtest/gtest.h>
#include <cmath> #include <cmath>
#include "paddle/fluid/inference/tests/api/tester_helper.h" #include "paddle/fluid/inference/tests/api/tester_helper.h"
...@@ -49,17 +50,14 @@ TEST(AnalysisPredictor, use_gpu) { ...@@ -49,17 +50,14 @@ TEST(AnalysisPredictor, use_gpu) {
ASSERT_TRUE(predictor->Run(inputs, &outputs)); ASSERT_TRUE(predictor->Run(inputs, &outputs));
const std::vector<float> truth_values = { const std::vector<float> truth_values = {
127.780396f, 738.16656f, 1013.2264f, -438.17206f, 366.4022f, 127.779, 738.165, 1013.22, -438.17, 366.401, 927.659, 736.222,
927.66187f, 736.2241f, -633.68567f, -329.92737f, -430.15637f, -633.684, -329.927, -430.155, -633.062, -146.548, -1324.28, -1349.36,
-633.0639f, -146.54858f, -1324.2804f, -1349.3661f, -242.67671f, -242.675, 117.448, -801.723, -391.514, -404.818, 454.16, 515.48,
117.44864f, -801.7251f, -391.51495f, -404.8202f, 454.16132f, -133.031, 69.293, 590.096, -1434.69, -1070.89, 307.074, 400.525,
515.48206f, -133.03114f, 69.293076f, 590.09753f, -1434.6917f, -316.12, -587.125, -161.056, 800.363, -96.4708, 748.706, 868.174,
-1070.8903f, 307.0744f, 400.52573f, -316.12177f, -587.1265f, -447.938, 112.737, 1127.2, 47.4355, 677.72, 593.186, -336.4,
-161.05742f, 800.3663f, -96.47157f, 748.708f, 868.17645f, 551.362, 397.823, 78.3979, -715.398, 405.969, 404.256, 246.019,
-447.9403f, 112.73656f, 1127.1992f, 47.43518f, 677.7219f, -8.42969, 131.365, -648.051};
593.1881f, -336.4011f, 551.3634f, 397.82474f, 78.39835f,
-715.4006f, 405.96988f, 404.25684f, 246.01978f, -8.430191f,
131.36617f, -648.0528f};
const size_t expected_size = 1; const size_t expected_size = 1;
EXPECT_EQ(outputs.size(), expected_size); EXPECT_EQ(outputs.size(), expected_size);
...@@ -108,17 +106,14 @@ TEST(Predictor, use_gpu) { ...@@ -108,17 +106,14 @@ TEST(Predictor, use_gpu) {
output_t->CopyToCpu(out_data.data()); output_t->CopyToCpu(out_data.data());
const std::vector<float> truth_values = { const std::vector<float> truth_values = {
127.780396f, 738.16656f, 1013.2264f, -438.17206f, 366.4022f, 127.779, 738.165, 1013.22, -438.17, 366.401, 927.659, 736.222,
927.66187f, 736.2241f, -633.68567f, -329.92737f, -430.15637f, -633.684, -329.927, -430.155, -633.062, -146.548, -1324.28, -1349.36,
-633.0639f, -146.54858f, -1324.2804f, -1349.3661f, -242.67671f, -242.675, 117.448, -801.723, -391.514, -404.818, 454.16, 515.48,
117.44864f, -801.7251f, -391.51495f, -404.8202f, 454.16132f, -133.031, 69.293, 590.096, -1434.69, -1070.89, 307.074, 400.525,
515.48206f, -133.03114f, 69.293076f, 590.09753f, -1434.6917f, -316.12, -587.125, -161.056, 800.363, -96.4708, 748.706, 868.174,
-1070.8903f, 307.0744f, 400.52573f, -316.12177f, -587.1265f, -447.938, 112.737, 1127.2, 47.4355, 677.72, 593.186, -336.4,
-161.05742f, 800.3663f, -96.47157f, 748.708f, 868.17645f, 551.362, 397.823, 78.3979, -715.398, 405.969, 404.256, 246.019,
-447.9403f, 112.73656f, 1127.1992f, 47.43518f, 677.7219f, -8.42969, 131.365, -648.051};
593.1881f, -336.4011f, 551.3634f, 397.82474f, 78.39835f,
-715.4006f, 405.96988f, 404.25684f, 246.01978f, -8.430191f,
131.36617f, -648.0528f};
float* data_o = out_data.data(); float* data_o = out_data.data();
for (size_t j = 0; j < out_num; j += 10) { for (size_t j = 0; j < out_num; j += 10) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册