wasm-micro-runtime/core/iwasm
YAMAMOTO Takashi 29d465b44e
wasi_nn_tensorflowlite.cpp: make this compatible with wasmedge (#4517)
for wasi_ephemeral_nn,

* implement u8 input

* stop dealing with quantization.

  * wasi-nn doesn't have a concept of quantization or pre/post-processing.
    i can't think of any ways to make the backend perform zero-point/scale
    processing without risking to break other applications.

  * there seems to be applications which just use u8 inputs/outputs for
    a quantized model. (see [1] for an example.)
    for certain kinds of inputs/outputs, it usually just works.

this commit keeps the legacy wasi_nn logic intact for now.

tested with [1] with [2] applied.

WAMR with this patch:
```
Read graph weights, size in bytes: 3561598
[wasi_nn.c:297 WARNING] load_by_name_with_config() not found
[wasi_nn_tensorflowlite.cpp:272 WARNING] Default encoding is CPU.
Loaded graph into wasi-nn with ID: Graph#0
Read input tensor, size in bytes: 150528
   1.) [166](198)Aix galericulata
   2.) [34](1)Gallus gallus domesticus
   3.) [158](1)Coccothraustes coccothraustes
   4.) [778](1)Sitta europaea
   5.) [819](1)Anas platyrhynchos
```

wasmedge:
```
Read graph weights, size in bytes: 3561598
Loaded graph into wasi-nn with ID: Graph#0
Read input tensor, size in bytes: 150528
   1.) [166](198)Aix galericulata
   2.) [34](1)Gallus gallus domesticus
   3.) [158](1)Coccothraustes coccothraustes
   4.) [778](1)Sitta europaea
   5.) [819](1)Anas platyrhynchos
```

and "Aix galericulata" seems like a reasonable classification
of the image to my eyes.

[1] 67f174bab5/tflite-birds_v1-image

[2] https://github.com/second-state/WasmEdge-WASINN-examples/pull/204

Related:
https://github.com/bytecodealliance/wasm-micro-runtime/issues/3555
https://github.com/bytecodealliance/wasm-micro-runtime/issues/2611
2025-08-01 14:31:02 +08:00
..
aot loader: add type index checking (#4521) 2025-08-01 08:58:26 +08:00
common Avoid executable stack by marking that it's not required. (#4418) 2025-08-01 14:30:39 +08:00
compilation modify macro related to simde when WASM_OP_SELECT_128 (#4461) 2025-07-17 08:04:41 +08:00
doc Fix some more spelling issues (#3393) 2024-05-08 09:30:29 +08:00
fast-jit Support extended constant expressions (#4432) 2025-07-07 13:34:02 +08:00
include introduce wasm_runtime_instantiate_ex2 (#4444) 2025-07-14 13:06:23 +08:00
interpreter add validation for recursive type count in loader (#4522) 2025-07-31 16:19:08 +08:00
libraries wasi_nn_tensorflowlite.cpp: make this compatible with wasmedge (#4517) 2025-08-01 14:31:02 +08:00
README.md Add architecture diagram for wasm globals and classic-interp stack frame (#2058) 2023-03-25 09:39:20 +08:00