wasm-micro-runtime/core/iwasm/libraries
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
..
debug-engine send an empty/error reply from server (#4362) 2025-06-17 13:00:58 +08:00
lib-pthread Add Windows wamrc and iwasm build in release CI (#3857) 2024-10-17 10:01:56 +08:00
lib-rats Keep fix the CMake compatibility issue (#4180) 2025-04-15 12:51:19 +08:00
lib-socket lib-socket: implement gai_strerror (#4508) 2025-07-29 11:12:27 +08:00
lib-wasi-threads fix: correct typos and improve comments across multiple files by codespell (#4116) 2025-03-07 08:21:54 +08:00
libc-builtin libc-builtin: Fix function prototype for wasm_runtime_module_realloc (#3702) 2024-08-13 17:44:58 +08:00
libc-emcc libc-emcc: Use alternate method to check getrandom support (#3848) 2024-10-10 10:57:47 +08:00
libc-uvwasi Bump uvwasi to latest commit #392e1f1 (#4312) 2025-06-03 13:21:17 +08:00
libc-wasi wasi: avoid user-triggerable 0-sized allocations (#4452) 2025-07-08 09:25:50 +08:00
shared-heap Implement shared heap for AOT (#3815) 2024-09-29 12:50:59 +08:00
simde Keep fix the CMake compatibility issue (#4180) 2025-04-15 12:51:19 +08:00
thread-mgr Fix potential integer overflow issues (#4429) 2025-07-01 13:39:30 +08:00
wasi-nn wasi_nn_tensorflowlite.cpp: make this compatible with wasmedge (#4517) 2025-08-01 14:31:02 +08:00