bytecodealliance / bytecodealliance/wasmtime

Wasi-NN examples with misaligned layout

Open
#4,464 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

First of all, thanks for the great implementation of Wasi-NN!
I found something misaligned while I tried to read the OpenVINO backend and the corresponding example.

In the example, we passed an image in form of a tensor with the shape `(1, 3, 224, 224)`:
https://github.com/bytecodealliance/wasmtime/blob/3032e3fcfbb818dd567f85561fce7813f5979747/crates/wasi-nn/examples/classification-example/src/main.rs#L29-L33
However, in the OpenVINO backend, the layout of input is fixed to `NHWC`, which I believe means `(Batch, Height, Width, Channel)`.
https://github.com/bytecodealliance/wasmtime/blob/3032e3fcfbb818dd567f85561fce7813f5979747/crates/wasi-nn/src/openvino.rs#L88

Does that mean the model will treat our input as an image with a height of 3 pixels, width of 224 pixels, and channel of 224 pixels? But why we can still get the correct prediction?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.