From 5478d267f4e95d1362221f31890fdf87338d0a75 Mon Sep 17 00:00:00 2001 From: YAMAMOTO Takashi Date: Thu, 12 Jun 2025 10:34:14 +0900 Subject: [PATCH] wasi_nn_openvino.c: remove the tensor layout adjustment logic (#4308) the logic in question seems like an attempt to work around some application bugs. my wild guess is that it was for classification-example. cf. https://github.com/bytecodealliance/wasmtime/issues/10867 --- .../libraries/wasi-nn/src/wasi_nn_openvino.c | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c b/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c index dcfec1ccb..d6aef67fe 100644 --- a/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c +++ b/core/iwasm/libraries/wasi-nn/src/wasi_nn_openvino.c @@ -308,17 +308,6 @@ set_input(void *ctx, graph_execution_context exec_ctx, uint32_t index, if (ret != success) goto fail; - /* NCHW -> NHWC */ - if (wasi_nn_tensor->dimensions->size == 4 || ov_dims[1] == 3) { - /* N */ - /* H */ - ov_dims[1] = ov_dims[2]; - /* W */ - ov_dims[2] = ov_dims[3]; - /* C */ - ov_dims[3] = 3; - } - CHECK_OV_STATUS(ov_shape_create(wasi_nn_tensor->dimensions->size, ov_dims, &input_shape), ret); @@ -354,11 +343,6 @@ set_input(void *ctx, graph_execution_context exec_ctx, uint32_t index, CHECK_OV_STATUS(ov_preprocess_input_tensor_info_set_from( input_tensor_info, ov_ctx->input_tensor), ret); - /* ! HAS TO BE NHWC. Match previous layout conversion */ - CHECK_OV_STATUS(ov_layout_create("NHWC", &input_layout), ret); - CHECK_OV_STATUS(ov_preprocess_input_tensor_info_set_layout( - input_tensor_info, input_layout), - ret); /* add RESIZE */ CHECK_OV_STATUS(ov_preprocess_input_info_get_preprocess_steps(