|
7 | 7 | <link href="https://www.w3.org/StyleSheets/TR/2021/W3C-ED" rel="stylesheet"> |
8 | 8 | <meta content="Bikeshed version 3f621ba99, updated Mon Jul 28 15:38:36 2025 -0700" name="generator"> |
9 | 9 | <link href="https://www.w3.org/TR/webnn/" rel="canonical"> |
10 | | - <meta content="5aec9975765aae61a3febae4bc0667ae037a6508" name="revision"> |
| 10 | + <meta content="8bce961de30b422a3cda7596eaede8f582f1a839" name="revision"> |
11 | 11 | <meta content="dark light" name="color-scheme"> |
12 | 12 | <link href="https://www.w3.org/StyleSheets/TR/2021/dark.css" media="(prefers-color-scheme: dark)" rel="stylesheet" type="text/css"> |
13 | 13 | <style> |
|
1022 | 1022 | </p> |
1023 | 1023 | <h1 class="p-name no-ref" id="title">Web Neural Network API</h1> |
1024 | 1024 | <p id="w3c-state"><a href="https://www.w3.org/standards/types/#ED">Editor’s Draft</a>, |
1025 | | - <time class="dt-updated" datetime="2025-08-29">29 August 2025</time></p> |
| 1025 | + <time class="dt-updated" datetime="2025-09-04">4 September 2025</time></p> |
1026 | 1026 | <details open> |
1027 | 1027 | <summary>More details about this document</summary> |
1028 | 1028 | <div data-fill-with="spec-metadata"> |
@@ -2475,6 +2475,8 @@ <h4 class="heading settled" data-level="8.3.7" id="api-mlcontext-opsupportlimits |
2475 | 2475 | The <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-opsupportlimits" id="ref-for-dom-mlcontext-opsupportlimits①">opSupportLimits()</a></code> exposes level of support that differs across implementations at operator level. Consumers of the WebNN API are encouraged to probe feature support level by using <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-opsupportlimits" id="ref-for-dom-mlcontext-opsupportlimits②">opSupportLimits()</a></code> to determine the optimal model architecture to be deployed for each target platform. |
2476 | 2476 |
|
2477 | 2477 |
|
| 2478 | + <p class="note" role="note"><span class="marker">Note:</span> The <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-opsupportlimits" id="ref-for-dom-mlcontext-opsupportlimits③">opSupportLimits()</a></code> API is not intended to provide additional entropy for browser fingerprinting. In current implementations this feature support information can be inferred from the OS and browser version alone. If the diversity of future implementations warrants it, this API allows future implementations to add new privacy mitigations e.g. to bucket capabilities similar to WebGPU to reduce entropy.</p> |
| 2479 | + <p>See [#privacy] for additional discussion of fingerprinting considerations.</p> |
2478 | 2480 | <h5 class="heading settled" data-level="8.3.7.1" id="api-mlcontext-opsupportlimits-dictionary"><span class="secno">8.3.7.1. </span><span class="content"><code class="idl"><a data-link-type="idl" href="#dictdef-mlopsupportlimits" id="ref-for-dictdef-mlopsupportlimits①">MLOpSupportLimits</a></code> dictionary</span><a class="self-link" href="#api-mlcontext-opsupportlimits-dictionary"></a></h5> |
2479 | 2481 |
|
2480 | 2482 | The <code class="idl"><a data-link-type="idl" href="#dictdef-mlopsupportlimits" id="ref-for-dictdef-mlopsupportlimits②">MLOpSupportLimits</a></code> has the following top level members, aside from these, each <a data-link-type="dfn" href="#operators" id="ref-for-operators⑦">operator</a> has a corresponding member defined in its builder method. |
@@ -2821,10 +2823,10 @@ <h3 class="heading settled" data-level="8.6" id="api-mloperand"><span class="sec |
2821 | 2823 | <p>The <dfn class="dfn-paneled idl-code" data-dfn-for="MLOperand" data-dfn-type="attribute" data-export id="dom-mloperand-shape"><code>shape</code></dfn> <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#getter-steps" id="ref-for-getter-steps①">getter steps</a> are to return <a data-link-type="dfn" href="https://webidl.spec.whatwg.org/#this" id="ref-for-this④⓪">this</a>’s <a data-link-type="dfn" href="#mloperand-shape" id="ref-for-mloperand-shape①">shape</a>.</p> |
2822 | 2824 | <p>Since the <code class="idl"><a data-link-type="idl" href="#dom-mloperand-builder-slot" id="ref-for-dom-mloperand-builder-slot">[[builder]]</a></code> object is bound by the <code class="idl"><a data-link-type="idl" href="#dom-mlgraphbuilder-mlgraphbuilder" id="ref-for-dom-mlgraphbuilder-mlgraphbuilder">MLGraphBuilder()</a></code> constructor to an <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③②">MLContext</a></code> object, an <code class="idl"><a data-link-type="idl" href="#mloperand" id="ref-for-mloperand③①">MLOperand</a></code> is also always bound to the same <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③③">MLContext</a></code> object.</p> |
2823 | 2825 | <p>If an operation supports only a subset of <code class="idl"><a data-link-type="idl" href="#enumdef-mloperanddatatype" id="ref-for-enumdef-mloperanddatatype⑥">MLOperandDataType</a></code>s, the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="allowed-data-types">allowed data types</dfn> for each of the operation’s input operands, including both positional arguments and options, are given as either an explicit list of <code class="idl"><a data-link-type="idl" href="#enumdef-mloperanddatatype" id="ref-for-enumdef-mloperanddatatype⑦">MLOperandDataType</a></code>s, or a constraint that the operand’s <a data-link-type="dfn" href="#mloperand-datatype" id="ref-for-mloperand-datatype①">dataType</a> must be the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="same type as" data-noexport id="same-type-as">same as</dfn> the <a data-link-type="dfn" href="#mloperand-datatype" id="ref-for-mloperand-datatype②">dataType</a> of another input operand, or <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="any data type" data-noexport id="any-data-type">any</dfn> to allow any <code class="idl"><a data-link-type="idl" href="#enumdef-mloperanddatatype" id="ref-for-enumdef-mloperanddatatype⑧">MLOperandDataType</a></code>.</p> |
2824 | | - <p>Implementations may support fewer data types for operands than specified. This can be queried for each operation using the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-opsupportlimits" id="ref-for-dom-mlcontext-opsupportlimits③">opSupportLimits()</a></code> method on <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③④">MLContext</a></code> and inspecting the <code class="idl"><a data-link-type="idl" href="#dom-mldatatypelimits-datatypes" id="ref-for-dom-mldatatypelimits-datatypes①">dataTypes</a></code> value of the corresponding member for the operation.</p> |
| 2826 | + <p>Implementations may support fewer data types for operands than specified. This can be queried for each operation using the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-opsupportlimits" id="ref-for-dom-mlcontext-opsupportlimits④">opSupportLimits()</a></code> method on <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③④">MLContext</a></code> and inspecting the <code class="idl"><a data-link-type="idl" href="#dom-mldatatypelimits-datatypes" id="ref-for-dom-mldatatypelimits-datatypes①">dataTypes</a></code> value of the corresponding member for the operation.</p> |
2825 | 2827 | <p class="issue" id="issue-e8dc06a2"><a class="self-link" href="#issue-e8dc06a2"></a> Should we specify the subset of data types that must be supported for each operator?</p> |
2826 | 2828 | <p>If an operation requires input operands with a particular <a data-link-type="dfn" href="#mloperand-rank" id="ref-for-mloperand-rank">rank</a>, the <dfn class="dfn-paneled" data-dfn-type="dfn" data-noexport id="allowed-ranks">allowed ranks</dfn> for each of the operation’s input operands, including both positional arguments and options, are given as an explicit rank (e.g. 1), or <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="any rank" data-noexport id="any-rank">N</dfn> to allow any dimensionality, or the <dfn class="dfn-paneled" data-dfn-type="dfn" data-lt="same rank as" data-noexport id="same-rank-as">same as</dfn> another operand. More specific constraints are common, such as when an input operand’s shape must be <a data-link-type="dfn" href="#unidirectionally-broadcastable" id="ref-for-unidirectionally-broadcastable">unidirectionally broadcastable</a> to or <a data-link-type="dfn" href="#bidirectionally-broadcastable" id="ref-for-bidirectionally-broadcastable">bidirectionally broadcastable</a> with another input operand; in these cases, the <a data-link-type="dfn" href="#allowed-ranks" id="ref-for-allowed-ranks">allowed ranks</a> are listed as a range, with specific validation given as steps in the operation.</p> |
2827 | | - <p>Implementations may impose a more restricted lower bound and/or upper bound on the <a data-link-type="dfn" href="#mloperand-rank" id="ref-for-mloperand-rank①">rank</a> of operands than specified. This can be queried for each operation using the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-opsupportlimits" id="ref-for-dom-mlcontext-opsupportlimits④">opSupportLimits()</a></code> method on <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③⑤">MLContext</a></code> and inspecting the <code class="idl"><a data-link-type="idl" href="#dom-mltensorlimits-rankrange" id="ref-for-dom-mltensorlimits-rankrange①">rankRange</a></code>.<code class="idl"><a data-link-type="idl" href="#dom-mlrankrange-min" id="ref-for-dom-mlrankrange-min①">min</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-mltensorlimits-rankrange" id="ref-for-dom-mltensorlimits-rankrange②">rankRange</a></code>.<code class="idl"><a data-link-type="idl" href="#dom-mlrankrange-max" id="ref-for-dom-mlrankrange-max①">max</a></code> values of the corresponding member for the operation.</p> |
| 2829 | + <p>Implementations may impose a more restricted lower bound and/or upper bound on the <a data-link-type="dfn" href="#mloperand-rank" id="ref-for-mloperand-rank①">rank</a> of operands than specified. This can be queried for each operation using the <code class="idl"><a data-link-type="idl" href="#dom-mlcontext-opsupportlimits" id="ref-for-dom-mlcontext-opsupportlimits⑤">opSupportLimits()</a></code> method on <code class="idl"><a data-link-type="idl" href="#mlcontext" id="ref-for-mlcontext③⑤">MLContext</a></code> and inspecting the <code class="idl"><a data-link-type="idl" href="#dom-mltensorlimits-rankrange" id="ref-for-dom-mltensorlimits-rankrange①">rankRange</a></code>.<code class="idl"><a data-link-type="idl" href="#dom-mlrankrange-min" id="ref-for-dom-mlrankrange-min①">min</a></code> and <code class="idl"><a data-link-type="idl" href="#dom-mltensorlimits-rankrange" id="ref-for-dom-mltensorlimits-rankrange②">rankRange</a></code>.<code class="idl"><a data-link-type="idl" href="#dom-mlrankrange-max" id="ref-for-dom-mlrankrange-max①">max</a></code> values of the corresponding member for the operation.</p> |
2828 | 2830 | <p><code class="idl"><a data-link-type="idl" href="#dictdef-mloperatoroptions" id="ref-for-dictdef-mloperatoroptions">MLOperatorOptions</a></code> has the following members:</p> |
2829 | 2831 | <dl> |
2830 | 2832 | <dt data-md><dfn class="dfn-paneled idl-code" data-dfn-for="MLOperatorOptions" data-dfn-type="dict-member" data-export id="dom-mloperatoroptions-label"><code>label</code></dfn>, <span> of type <a data-link-type="idl-name" href="https://webidl.spec.whatwg.org/#idl-USVString" id="ref-for-idl-USVString⑥">USVString</a>, defaulting to <code>""</code></span> |
@@ -16446,7 +16448,7 @@ <h2 class="no-num no-ref heading settled" id="issues-index"><span class="content |
16446 | 16448 | "dom-mlcontext-dispatch-graph-inputs-outputs-outputs": {"dfnID":"dom-mlcontext-dispatch-graph-inputs-outputs-outputs","dfnText":"outputs","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-dispatch-graph-inputs-outputs-outputs"}],"title":"8.3. MLContext interface"}],"url":"#dom-mlcontext-dispatch-graph-inputs-outputs-outputs"}, |
16447 | 16449 | "dom-mlcontext-lost": {"dfnID":"dom-mlcontext-lost","dfnText":"lost","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-lost"}],"title":"8.3. MLContext interface"}],"url":"#dom-mlcontext-lost"}, |
16448 | 16450 | "dom-mlcontext-lost-slot": {"dfnID":"dom-mlcontext-lost-slot","dfnText":"[[lost]]","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-lost-slot"}],"title":"8.2.2. createContext()"},{"refs":[{"id":"ref-for-dom-mlcontext-lost-slot\u2460"},{"id":"ref-for-dom-mlcontext-lost-slot\u2461"},{"id":"ref-for-dom-mlcontext-lost-slot\u2462"}],"title":"8.3.9. Errors"}],"url":"#dom-mlcontext-lost-slot"}, |
16449 | | -"dom-mlcontext-opsupportlimits": {"dfnID":"dom-mlcontext-opsupportlimits","dfnText":"opSupportLimits","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-opsupportlimits"},{"id":"ref-for-dom-mlcontext-opsupportlimits\u2460"},{"id":"ref-for-dom-mlcontext-opsupportlimits\u2461"}],"title":"8.3.7. opSupportLimits()"},{"refs":[{"id":"ref-for-dom-mlcontext-opsupportlimits\u2462"},{"id":"ref-for-dom-mlcontext-opsupportlimits\u2463"}],"title":"8.6. MLOperand interface"}],"url":"#dom-mlcontext-opsupportlimits"}, |
| 16451 | +"dom-mlcontext-opsupportlimits": {"dfnID":"dom-mlcontext-opsupportlimits","dfnText":"opSupportLimits","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-opsupportlimits"},{"id":"ref-for-dom-mlcontext-opsupportlimits\u2460"},{"id":"ref-for-dom-mlcontext-opsupportlimits\u2461"},{"id":"ref-for-dom-mlcontext-opsupportlimits\u2462"}],"title":"8.3.7. opSupportLimits()"},{"refs":[{"id":"ref-for-dom-mlcontext-opsupportlimits\u2463"},{"id":"ref-for-dom-mlcontext-opsupportlimits\u2464"}],"title":"8.6. MLOperand interface"}],"url":"#dom-mlcontext-opsupportlimits"}, |
16450 | 16452 | "dom-mlcontext-powerpreference-slot": {"dfnID":"dom-mlcontext-powerpreference-slot","dfnText":"[[powerPreference]]","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-powerpreference-slot"},{"id":"ref-for-dom-mlcontext-powerpreference-slot\u2460"},{"id":"ref-for-dom-mlcontext-powerpreference-slot\u2461"}],"title":"8.2.2. createContext()"}],"url":"#dom-mlcontext-powerpreference-slot"}, |
16451 | 16453 | "dom-mlcontext-readtensor": {"dfnID":"dom-mlcontext-readtensor","dfnText":"readTensor(tensor)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-readtensor"}],"title":"7.1. Overview"},{"refs":[{"id":"ref-for-dom-mlcontext-readtensor\u2460"}],"title":"8.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcontext-readtensor\u2461"}],"title":"8.3.4. readTensor(tensor)"},{"refs":[{"id":"ref-for-dom-mlcontext-readtensor\u2462"}],"title":"8.3.5. readTensor(tensor, outputData)"},{"refs":[{"id":"ref-for-dom-mlcontext-readtensor\u2463"}],"title":"8.7. MLTensorDescriptor dictionary"},{"refs":[{"id":"ref-for-dom-mlcontext-readtensor\u2464"}],"title":"8.8. MLTensor interface"}],"url":"#dom-mlcontext-readtensor"}, |
16452 | 16454 | "dom-mlcontext-readtensor-tensor-outputdata": {"dfnID":"dom-mlcontext-readtensor-tensor-outputdata","dfnText":"readTensor(tensor, outputData)","external":false,"refSections":[{"refs":[{"id":"ref-for-dom-mlcontext-readtensor-tensor-outputdata"}],"title":"8.3. MLContext interface"},{"refs":[{"id":"ref-for-dom-mlcontext-readtensor-tensor-outputdata\u2460"}],"title":"8.3.5. readTensor(tensor, outputData)"},{"refs":[{"id":"ref-for-dom-mlcontext-readtensor-tensor-outputdata\u2461"}],"title":"8.7. MLTensorDescriptor dictionary"}],"url":"#dom-mlcontext-readtensor-tensor-outputdata"}, |
|
0 commit comments