Skip to content

Commit 9555bef

Browse files
authored
Merge pull request #64 from ibelem/zh
Update simplified Chinese files
2 parents b2225ae + 3bcc0ce commit 9555bef

53 files changed

Lines changed: 1845 additions & 1847 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

content/zh/api-reference/_meta.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
export default {
22
reference: {
3-
title: "API Reference"
3+
title: "API 参考"
44
},
55
webnn: {
66
title: "WebNN API"
77
},
88
'browser-compatibility': {
9-
title: "Browser Compatibility"
9+
title: "浏览器兼容性"
1010
},
1111
'onnx-runtime': {
1212
title: "ONNX Runtime"

content/zh/api-reference/browser-compatibility/_meta.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ export default {
33
title: "WebNN API"
44
},
55
litert: {
6-
title: "Lite RT Backend"
6+
title: "Lite RT 后端"
77
},
88
windowsml: {
9-
title: "Windows ML Backend"
9+
title: "Windows ML 后端"
1010
},
1111
coreml: {
12-
title: "Core ML Backend"
12+
title: "Core ML 后端"
1313
},
1414
"chrome-flags": {
1515
title: "Chrome Flags"
1616
},
1717
deviceselection: {
18-
title: "Device Selection"
18+
title: "设备选择"
1919
},
2020
};

content/zh/api-reference/browser-compatibility/api.mdx

Lines changed: 41 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -3,60 +3,60 @@ import InfoIcon from '../../../../app/_components/icons/info.jsx'
33

44
<div className="mdx-table">
55

6-
# Browser Compatibility
6+
# 浏览器兼容性
77

8-
## WebNN APIs
8+
## WebNN API
99

10-
> <InfoIcon /> May 20, 2025: DirectML was officially deprecated during Microsoft Build 2025. WebNN will leverage Windows ML to access OpenVINO and other EPs to get hardware acceleration.
10+
> <InfoIcon /> 2025 年 5 月 20 日:DirectML 在 Microsoft Build 2025 期间被正式弃用。WebNN 将利用 Windows ML 访问 OpenVINO 和其他 EP 以获得硬件加速。
1111
1212
<div className="table">
13-
| Platform / Build Conditions | CPU (`device: "cpu"`) | GPU (`device: "gpu"`) | NPU (`device: "npu"`) |
13+
|平台/建设条件|CPU`device: "cpu"`|GPU`device: "gpu"`|NPU`device: "npu"`|
1414
| --- | --- | --- | --- |
15-
| ChromeOS (`webnn_use_tflite` default true) | TFLite (LiteRT) with XNNPACK delegate (`tflite/graph_impl_tflite.cc``SetUpXNNPackDelegate`) | TFLite delegate: Chrome ML GPU if `WEBNN_USE_CHROME_ML_API` (controlled by `features.gni`), otherwise OpenCL delegate when `BUILD_TFLITE_WITH_OPENCL`; without either, runs on XNNPACK/CPU (`tflite/graph_impl_tflite.cc`) | No dedicated delegate; request falls back to CPU/XNNPACK (`tflite/graph_impl_tflite.cc`) |
16-
| Linux (`webnn_use_tflite` default true) | Same TFLite + XNNPACK path | No native GPU backend today; execution remains on CPU via XNNPACK (`webnn_context_provider_impl.cc` falls through to TFLite) | Not supported; falls back to CPU |
17-
| macOS ≥14.4 on Apple Silicon with feature `kWebNNCoreML` enabled (default) | Core ML backend (`webnn_context_provider_impl.cc`; `coreml/context_impl_coreml.mm`) selecting `MLComputeUnitsCPUOnly` (`coreml/graph_impl_coreml.mm`) | Core ML using `MLComputeUnitsCPUAndGPU` or `MLComputeUnitsAll` (gated by `kWebNNCoreMLExplicitGPUOrNPU`) | Core ML using `MLComputeUnitsCPUAndNeuralEngine` or `MLComputeUnitsAll` (`coreml/graph_impl_coreml.mm`) |
18-
| macOS Intel, macOS &lt;14.4, or Core ML feature disabled | Falls through to TFLite + XNNPACK (`webnn_context_provider_impl.cc`) | TFLite delegates as available (no Core ML) | TFLite fallback only |
19-
| Windows 11 24H2+ with feature `kWebNNOnnxRuntime` enabled | ONNX Runtime (Windows ML) (`ort/context_provider_ort.cc`; `webnn_context_provider_impl.cc`) selecting CPU EP (`ort/environment.cc`) | ONNX Runtime selecting GPU EP with CPU fallback (`ort/environment.cc`) | ONNX Runtime selecting NPU EP with CPU fallback (`ort/environment.cc`) |
20-
| Windows (default build: ONNX Runtime feature off) | TFLite + XNNPACK fallback (`webnn_context_provider_impl.cc`) | DirectML backend when `kWebNNDirectML` feature is on and GPU feature is enabled (`dml/context_provider_dml.cc`); otherwise TFLite | DirectML NPU path when hardware is available (`dml/context_provider_dml.cc`); otherwise TFLite |
21-
| Android | TFLite + XNNPACK (`tflite/graph_impl_tflite.cc`) | TFLite GPU delegate via OpenCL when `BUILD_TFLITE_WITH_OPENCL` (or Chrome ML if bundled); otherwise CPU fallback | TFLite NNAPI delegate when `BUILD_TFLITE_WITH_NNAPI` (typical Android build); otherwise CPU fallback |
22-
| iOS (current shipping defaults) | Core ML feature disabled by default (`public/mojom/features.mojom`), so TFLite + XNNPACK | Same as CPU (no Core ML delegate by default) | Same as CPU |
15+
|ChromeOS`webnn_use_tflite` 默认 true|TFLite ( LiteRT ) 与 XNNPACK delegate ( `tflite/graph_impl_tflite.cc``SetUpXNNPackDelegate` ) |TFLite 委托:如果 `WEBNN_USE_CHROME_ML_API` 则为 Chrome ML GPU(由 `features.gni` 控制),否则当 `BUILD_TFLITE_WITH_OPENCL` 时为 OpenCL 委托;没有任何一个,在 XNNPACK/CPU 上运行 ( `tflite/graph_impl_tflite.cc` ) |没有专职代表;请求回退到 CPU/XNNPACK ( `tflite/graph_impl_tflite.cc` ) |
16+
|Linux ( `webnn_use_tflite` 默认 true) |相同的 TFLite + XNNPACK 路径 |目前还没有原生 GPU 后端;通过 XNNPACK 保留在 CPU 上执行(`webnn_context_provider_impl.cc` 落入 TFLite|不支持;回到CPU |
17+
|Apple Silicon 上的 macOS ≥14.4,启用 `kWebNNCoreML` 功能(默认)|Core ML 后端 ( `webnn_context_provider_impl.cc` ; `coreml/context_impl_coreml.mm` ) 选择 `MLComputeUnitsCPUOnly` ( `coreml/graph_impl_coreml.mm` ) |使用 `MLComputeUnitsCPUAndGPU` `MLComputeUnitsAll` 的 Core ML(由 `kWebNNCoreMLExplicitGPUOrNPU` 门控) |使用 `MLComputeUnitsCPUAndNeuralEngine` `MLComputeUnitsAll` ( `coreml/graph_impl_coreml.mm` ) 的 Core ML |
18+
|macOS IntelmacOS &lt;14.4 Core ML 功能已禁用 |落入 TFLite + XNNPACK ( `webnn_context_provider_impl.cc` ) |TFLite 代表可用(无 Core ML| TFLite 后备 |
19+
|Windows 11 24H2+ 启用功能 `kWebNNOnnxRuntime` |ONNX Runtime (Windows ML) ( `ort/context_provider_ort.cc` ; `webnn_context_provider_impl.cc` ) 选择 CPU EP ( `ort/environment.cc` ) |ONNX Runtime 选择带有 CPU 回退的 GPU EP (`ort/environment.cc`) |ONNX Runtime 选择带 CPU 回退的 NPU EP (`ort/environment.cc`) |
20+
|Windows(默认版本:ONNX Runtime 功能关闭)|TFLite + XNNPACK 后备 ( `webnn_context_provider_impl.cc` ) |`kWebNNDirectML` 功能开启且 GPU 功能启用时 ( `dml/context_provider_dml.cc` ) 时的 DirectML 后端;否则 TFLite |硬件可用时的 DirectML NPU 路径 ( `dml/context_provider_dml.cc` );否则 TFLite |
21+
|安卓 |TFLite + XNNPACK ( `tflite/graph_impl_tflite.cc` ) |`BUILD_TFLITE_WITH_OPENCL` 时通过 OpenCL 进行 TFLite GPU 委托(或 Chrome ML,如果捆绑);否则CPU回退|`BUILD_TFLITE_WITH_NNAPI` 时的 TFLite NNAPI 委托(典型的 Android 构建);否则CPU回退|
22+
|iOS(当前默认发货)|默认情况下禁用 Core ML 功能 ( `public/mojom/features.mojom` ),因此 TFLite + XNNPACK |CPU 相同(默认情况下没有 Core ML 委托)|与CPU相同|
2323
</div>
2424

25-
- Backend selection order is defined in `webnn_context_provider_impl.cc`: Windows tries ONNX Runtime first, then DirectML, then the TFLite fallback; Apple builds try Core ML before TFLite; all other platforms go straight to TFLite.
26-
- `features.gni` enables TFLite (`webnn_use_tflite`) across Linux, ChromeOS, Android, Windows, and Apple; `webnn_use_chrome_ml_api` gates access to Chrome ML GPU delegates.
27-
- TFLite delegates are optional: if a requested delegate (GPU/NPU) is missing or fails, execution transparently falls back to the XNNPACK CPU path (`graph_impl_tflite.cc`).
28-
- ONNX Runtime support currently requires Windows 11 24H2+, the `kWebNNOnnxRuntime` flag, and uses `execution-provider` selection logic in `environment.cc` to bind the appropriate hardware (GPU/NPU) with CPU fallbacks.
29-
- Core ML respects the requested device by adjusting `MLModelConfiguration.computeUnits`; without `kWebNNCoreMLExplicitGPUOrNPU`, GPU/NPU requests default to `MLComputeUnitsAll` (`graph_impl_coreml.mm`).
25+
- 后端选择顺序在 `webnn_context_provider_impl.cc` 中定义:Windows 首先尝试 ONNX Runtime,然后是 DirectML,然后是 TFLite 回退;Apple TFLite 之前构建了 Core ML 尝试;所有其他平台均直接转至 TFLite
26+
- `features.gni` LinuxChromeOSAndroidWindows Apple 上启用 TFLite ( `webnn_use_tflite` ); `webnn_use_chrome_ml_api` 控制对 Chrome ML GPU 委托的访问。
27+
- TFLite 委托是可选的:如果请求的委托 (GPU/NPU) 丢失或失败,执行会透明地回退到 XNNPACK CPU 路径 ( `graph_impl_tflite.cc` )。
28+
- ONNX Runtime 支持当前需要 Windows 11 24H2+`kWebNNOnnxRuntime` 标志,并使用 `environment.cc` 中的 `execution-provider` 选择逻辑将适当的硬件 (GPU/NPU) CPU 后备绑定。
29+
- Core ML 通过调整 `MLModelConfiguration.computeUnits` 来尊重所请求的设备;如果没有 `kWebNNCoreMLExplicitGPUOrNPU`GPU/NPU 请求默认为 `MLComputeUnitsAll` ( `graph_impl_coreml.mm` )。
3030

31-
### Note
31+
### 笔记
3232

33-
- The WebNN API mainly supported with Chromium-based browsers on ChromeOS, Linux, macOS, Windows and Android.
34-
- Chromium-based browsers include but are not limited to Google Chrome, Microsoft Edge, Opera, Vivaldi, Brave, Samsung Internet etc.
33+
- WebNN API 主要支持 ChromeOSLinuxmacOSWindows Android 上基于 Chromium 的浏览器。
34+
- 基于 Chromium 的浏览器包括但不限于 Google ChromeMicrosoft EdgeOperaVivaldiBraveSamsung Internet 等。
3535

3636
<div className="table">
37-
| Interface | Method | Chromium Version |
37+
|接口|方法|铬版 |
3838
| --- | --- | --- |
3939
| navigator.ml | | M112 |
40-
| ML | | M112 |
41-
| ML | createContext() | M112 |
42-
| MLContext | | M112 |
43-
|MLContext|dispatch()|M128|
44-
|MLContext|createTensor()|M129|
45-
|MLContext|readTensor(tensor)|M129|
46-
|MLContext|readTensor(tensor, outputData)|M129|
47-
|MLContext|writeTensor()|M129|
48-
|MLContext|opSupportLimits()|M128|
49-
|MLGraph|| M112|
50-
|MLOperand||M112|
51-
|MLOperand| MLNumber | M132 |
52-
|MLTensor|| M124|
53-
|MLTensor|destroy()| M124 |
54-
|MLGraphBuilder| | M112|
55-
|MLGraphBuilder| MLGraphBuilder() constructor | M112 |
56-
|MLGraphBuilder| input(name, descriptor)| M112|
57-
|MLGraphBuilder| constant(descriptor, buffer) | M112|
58-
|MLGraphBuilder| constant(type, value) | M112|
59-
|MLGraphBuilder| build(outputs)| M112|
40+
|机器学习 ||M112 |
41+
|机器学习 |创建上下文()|M112 |
42+
|MLContext ||M112 |
43+
|MLContext |调度()|M128|
44+
|MLContext |createTensor()|M129|
45+
|MLContext |读取张量(张量)|M129|
46+
|MLContext |readTensor(张量, 输出数据)|M129|
47+
|MLContext |writeTensor()|M129|
48+
|MLContext |opSupportLimits()|M128|
49+
|MLGraph||M112|
50+
| ML操作数||M112|
51+
|MLOperand |ML编号 |M132 |
52+
|MLTensor ||M124|
53+
|MLTensor |销毁()|M124 |
54+
|MLGraphBuilder ||M112|
55+
|MLGraphBuilder |MLGraphBuilder () 构造函数 |M112 |
56+
|MLGraphBuilder |输入(名称,描述符)|M112|
57+
|MLGraphBuilder |常量(描述符,缓冲区)|M112|
58+
|MLGraphBuilder |常量(类型,值) |M112|
59+
|MLGraphBuilder |构建(输出)|M112|
6060
</div>
6161

6262
</div>

0 commit comments

Comments
 (0)