From c181159783d1245adb9bb1af18a469ad7d89df45 Mon Sep 17 00:00:00 2001 From: Wanming Lin Date: Wed, 1 Nov 2023 11:30:32 +0800 Subject: [PATCH] [WebNN EP] Restore to use deviceType enum (#18154) The Chromium implementation will support `MLDeviceType` enum to align with spec. CL: https://chromium-review.googlesource.com/c/chromium/src/+/4986939 --- .../core/providers/webnn/webnn_execution_provider.cc | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/onnxruntime/core/providers/webnn/webnn_execution_provider.cc b/onnxruntime/core/providers/webnn/webnn_execution_provider.cc index 26c739e9a1ce1..02a3d16b5b64f 100644 --- a/onnxruntime/core/providers/webnn/webnn_execution_provider.cc +++ b/onnxruntime/core/providers/webnn/webnn_execution_provider.cc @@ -26,11 +26,7 @@ WebNNExecutionProvider::WebNNExecutionProvider( ORT_THROW("Failed to get ml from navigator."); } emscripten::val context_options = emscripten::val::object(); - // Currently WebNN implementation in Chromium temporarily reuses the MLContextOptions - // defined in Model Loader API, which uses MLDevicePreference instead of MLDeviceType - // defined in WebNN. Because there's an ongoing spec discussion to simplify this API at - // https://github.com/webmachinelearning/webnn/issues/302. - context_options.set("devicePreference", emscripten::val(webnn_device_flags)); + context_options.set("deviceType", emscripten::val(webnn_device_flags)); // WebNN EP uses NHWC layout for CPU XNNPACK backend and NCHW for GPU DML backend. if (webnn_device_flags.compare("cpu") == 0) { preferred_layout_ = DataLayout::NHWC;