wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

Wasi-NN examples with misaligned layout

Open gusye1234 opened this issue 2 years ago • 0 comments

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?

gusye1234 avatar Jul 18 '22 15:07 gusye1234