提交 8fe95762 编写于 作者: 开心的小妮's avatar 开心的小妮

add test for cxx and light api of getoutput. test=develop

上级 39ad0c74
......@@ -129,6 +129,12 @@ TEST(CXXApi, load_model_naive) {
0.8938774});
auto* output_tensor = predictor.GetOutput(0);
const std::vector<std::string> output_names = predictor.GetOutputNames();
for (int i = 0; i < outputs.size(); i++) {
LOG(INFO) << "output_names[" << i << "]:" << output_names[i];
}
auto* output_tensor_by_name = predictor.GetOutput(output_names[0]);
CHECK(output_tensor == output_tensor_by_name);
auto output_shape = output_tensor->dims().Vectorize();
ASSERT_EQ(output_shape.size(), 2);
ASSERT_EQ(output_shape[0], 1);
......
......@@ -51,6 +51,8 @@ TEST(LightAPI, load) {
predictor.Run();
const auto* output = predictor.GetOutput(0);
const auto* output_by_name = predictor.GetOutput(outputs[0]);
CHECK(output == output_by_name);
const float* raw_output = output->data<float>();
for (int i = 0; i < 10; i++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册