Paddle-Lite Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

332nm8kg  于 2022-10-27  发布在  其他
关注(0)|答案(2)|浏览(216)

用的是 2.9的opt lib版本为768fb07

bnlyeluc

bnlyeluc1#

您好,我们已经收到了您的问题,会安排技术人员尽快解答您的问题,请耐心等待。请您再次检查是否提供了清晰的问题描述、复现代码、环境&版本、报错信息等。同时,您也可以通过查看 官网文档常见问题历史Issue 来寻求解答。祝您生活愉快~

Hi! We've received your issue and please be patient to get responded. We will arrange technicians to answer your questions as soon as possible. Please make sure that you have posted enough message to demo your request. You may also check out the APIFAQ and Github Issue to get the answer.Have a nice day!

wtzytmuj

wtzytmuj2#

include

#include "paddle_api.h"

int64_t ShapeProduction(const paddle::lite_api::shape_t& shape) {
int64_t res = 1;
for (auto i : shape) res *= i;
return res;
}

int main()
{
paddle::lite_api::MobileConfig config;
config.set_model_from_file("../model/ssdlite_small_fpn.nb");
config.set_threads(4);
config.set_power_mode(paddle::lite_api::LITE_POWER_HIGH);

std::shared_ptr<paddle::lite_api::PaddlePredictor> predictor = paddle::lite_api::CreatePaddlePredictor<paddle::lite_api::MobileConfig>(config);

 std::cout<<predictor->GetVersion()<<std::endl;

 std::unique_ptr<paddle::lite_api::Tensor> input_tensor=predictor->GetInput(0);
    input_tensor->Resize({1, 3, 320, 320});
    auto* data = input_tensor->mutable_data<uint8_t>();
    for (int i = 0; i < ShapeProduction(input_tensor->shape()); ++i) {
        data[i] = 1;
    }
predictor->Run();
std::unique_ptr<const paddle::lite_api::Tensor> output_tensor(std::move(predictor->GetOutput(0)));
printf("Output dim: %d\n", output_tensor->shape()[1]);
for (int i = 0; i < ShapeProduction(output_tensor->shape()); i += 100) {
    printf("Output[%d]: %f\n", i, output_tensor->data<float>()[i]);
}

}

完整代码如上

相关问题