#include <pybind11/pybind11.h>#include <pybind11/stl.h>#include <memory>#include <functional>#include <string>#include <unordered_map>#include <vector>#include "pypreproc.h"namespace py = pybind11;bool TestPyPreproc(const std::unordered_map<std::string, std::string> ¶ms) {auto model = std::make_shared<edk::ModelLoader>("data/test_model.cambricon", "subnet0");std::vector<float*> inputs;for (uint32_t i = 0; i < model->InputNum(); ++i) {inputs.push_back(new float[model->InputShape(i).DataCount()]);}auto free_inputs = [&inputs] () {for (auto ptr : inputs) delete[] ptr;};cnstream::PyPreproc pypreproc;if (!pypreproc.Init(params)) {free_inputs();return false;}bool ret = 0 == pypreproc.Execute(inputs, model, nullptr);free_inputs();return ret;}void PreprocTestWrapper(py::module &m) { // NOLINTm.def("cpptest_pypreproc", &TestPyPreproc);}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。