#include #include #include #include #include #include #include #include "pypreproc.h" namespace py = pybind11; bool TestPyPreproc(const std::unordered_map ¶ms) { auto model = std::make_shared("data/test_model.cambricon", "subnet0"); std::vector 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) { // NOLINT m.def("cpptest_pypreproc", &TestPyPreproc); }