| 45 | } |
| 46 | |
| 47 | std::unique_ptr<WasmEdge::Host::WasiNNModule> |
| 48 | createModule(std::string_view NNRPCURI = "") { |
| 49 | WasmEdge::Plugin::Plugin::load( |
| 50 | std::filesystem::u8path("../../../plugins/wasi_nn/" WASMEDGE_LIB_PREFIX |
| 51 | "wasmedgePluginWasiNN" WASMEDGE_LIB_EXTENSION)); |
| 52 | if (const auto *Plugin = WasmEdge::Plugin::Plugin::find("wasi_nn"sv)) { |
| 53 | WasmEdge::PO::ArgumentParser Parser; |
| 54 | Plugin->registerOptions(Parser); |
| 55 | if (NNRPCURI != "") { |
| 56 | Parser.set_raw_value<std::string>("nn-rpc-uri"sv, std::string(NNRPCURI)); |
| 57 | } |
| 58 | if (const auto *Module = Plugin->findModule("wasi_nn"sv)) { |
| 59 | return dynamicPointerCast<WasmEdge::Host::WasiNNModule>(Module->create()); |
| 60 | } |
| 61 | } |
| 62 | return {}; |
| 63 | } |
| 64 | |
| 65 | inline std::vector<uint8_t> readEntireFile |
| 66 | [[maybe_unused]] (const std::string &Path) { |
no test coverage detected