MCPcopy Create free account
hub / github.com/WasmEdge/WasmEdge / createModule

Function createModule

test/plugins/wasi_nn/wasi_nn.cpp:47–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45}
46
47std::unique_ptr<WasmEdge::Host::WasiNNModule>
48createModule(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
65inline std::vector<uint8_t> readEntireFile
66 [[maybe_unused]] (const std::string &Path) {

Callers 1

TESTFunction · 0.70

Calls 4

registerOptionsMethod · 0.80
loadFunction · 0.50
findModuleMethod · 0.45
createMethod · 0.45

Tested by

no test coverage detected