This repository has been archived on 2023-11-05. You can view files and clone it, but cannot push or open issues or pull requests.
wasm-micro-runtime/core/iwasm/libraries/wasi-nn
tonibofarull 9eed6686df
Refactor WASI-NN to simplify the support for multiple frameworks (#1834)
- Reorganize the library structure
- Use the latest version of `wasi-nn` wit (Oct 25, 2022):
    0f77c48ec1/wasi-nn.wit.md
- Split logic that converts WASM structs to native structs in a separate file
- Simplify addition of new frameworks
2023-01-25 18:32:40 +08:00
..
src Refactor WASI-NN to simplify the support for multiple frameworks (#1834) 2023-01-25 18:32:40 +08:00
test Refactor WASI-NN to simplify the support for multiple frameworks (#1834) 2023-01-25 18:32:40 +08:00
README.md Refactor WASI-NN to simplify the support for multiple frameworks (#1834) 2023-01-25 18:32:40 +08:00
wasi_nn_types.h Refactor WASI-NN to simplify the support for multiple frameworks (#1834) 2023-01-25 18:32:40 +08:00
wasi_nn.cmake Refactor WASI-NN to simplify the support for multiple frameworks (#1834) 2023-01-25 18:32:40 +08:00
wasi_nn.h Refactor WASI-NN to simplify the support for multiple frameworks (#1834) 2023-01-25 18:32:40 +08:00

WASI-NN

How to use

Enable WASI-NN in the WAMR by spefiying it in the cmake building configuration as follows,

set (WAMR_BUILD_WASI_NN  1)

The definition of the functions provided by WASI-NN is in the header file core/iwasm/libraries/wasi-nn/wasi_nn.h.

By only including this file in your WASM application you will bind WASI-NN into your module.

Tests

To run the tests we assume that the current directory is the root of the repository.

  1. Build the docker image,
docker build -t wasi-nn -f core/iwasm/libraries/wasi-nn/test/Dockerfile .
  1. Run the container
docker run wasi-nn

If all the tests have run properly you will the the following message in the terminal,

Tests: passed!

What is missing

Supported:

  • Only 1 WASM app at a time.
  • Only 1 model at a time.
    • graph and graph-execution-context are ignored.
  • Graph encoding: tensorflowlite.
  • Execution target: cpu.
  • Tensor type: fp32.