Fix for issue #3948 (#3956)

Updates the OpenVINO backend for wasi-nn to pre-configure all inputs as `NHWC`. This is not a long-term fix but no worse than the status quo, which configures all input tensors to the same layout. This change updates the CI script to use the latest version of OpenVINO. Closes #3948.

Co-authored-by: Andrew Brown <andrew.brown@intel.com>
This commit is contained in:
Brian Jones
2022-03-24 13:32:52 -07:00
committed by GitHub
parent 13ec5ff64c
commit 65b443ad23
5 changed files with 42 additions and 18 deletions

View File

@@ -17,7 +17,7 @@ anyhow = "1.0"
wiggle = { path = "../wiggle", version = "=0.35.0" }
# These dependencies are necessary for the wasi-nn implementation:
openvino = { version = "0.3.1", features = ["runtime-linking"] }
openvino = { version = "0.3.3", features = ["runtime-linking"] }
thiserror = "1.0"
[build-dependencies]

View File

@@ -40,7 +40,15 @@ impl Backend for OpenvinoBackend {
.0
.as_mut()
.expect("openvino::Core was previously constructed");
let cnn_network = core.read_network_from_buffer(&xml, &weights)?;
let mut cnn_network = core.read_network_from_buffer(&xml, &weights)?;
// TODO this is a temporary workaround. We need a more eligant way to specify the layout in the long run.
// However, without this newer versions of OpenVINO will fail due to parameter mismatch.
for i in 0..cnn_network.get_inputs_len()? {
let name = cnn_network.get_input_name(i)?;
cnn_network.set_input_layout(&name, Layout::NHWC)?;
}
let exec_network =
core.load_network(&cnn_network, map_execution_target_to_string(target))?;