| // Copyright 2022 The Chromium Authors |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| // https://www.w3.org/TR/webnn/#api-mlcontextoptions |
| |
| // Corresponds to WebNN MLDeviceType enum |
| // https://www.w3.org/TR/webnn/#enumdef-mldevicetype |
| enum MLDeviceType { |
| "cpu", |
| "gpu", |
| "npu" |
| }; |
| |
| enum MLPowerPreference { |
| // Let the user agent select the most suitable behavior. |
| "default", |
| // Prioritizes execution speed over power consumption. |
| "high-performance", |
| // Prioritizes power consumption over other considerations such as execution |
| // speed. |
| "low-power", |
| }; |
| |
| dictionary MLContextOptions { |
| // Specified type of device used for WebNN API. |
| MLDeviceType deviceType = "cpu"; |
| |
| // Preference as related to power consumption. |
| MLPowerPreference powerPreference = "default"; |
| }; |