Skip to content

Commit 8827c18

Browse files
committed
define graph.devices
1 parent ed9b56c commit 8827c18

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

index.bs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1374,8 +1374,15 @@ A {{MLContext}} <dfn for=MLContext lt="is lost|is not lost">is lost</dfn> if its
13741374
The {{MLGraph}} interface represents a compiled computational graph. A compiled graph once constructed is immutable and cannot be subsequently changed.
13751375

13761376
<script type=idl>
1377+
enum MLDeviceType {
1378+
"cpu",
1379+
"gpu",
1380+
"npu"
1381+
};
1382+
13771383
[SecureContext, Exposed=(Window, Worker)]
13781384
interface MLGraph {
1385+
readonly attribute FrozenArray<MLDeviceType> devices;
13791386
undefined destroy();
13801387
};
13811388
</script>
@@ -1405,6 +1412,17 @@ interface MLGraph {
14051412
</dl>
14061413
</div>
14071414

1415+
### {{MLGraph/devices}} ### {#api-mlgraph-devices}
1416+
The <dfn attribute for=MLGraph>devices</dfn> attribute is a {{FrozenArray}} containing the list of {{MLDeviceType}}s that the {{MLGraph}} will be executed on. A graph could be executed on multiple types of devices that are one of following:
1417+
<dl dfn-for="MLDeviceType">
1418+
<dt>"<dfn enum-value>cpu</dfn>"</dt>
1419+
<dd>CPU device.</dd>
1420+
<dt>"<dfn enum-value>gpu</dfn>"</dt>
1421+
<dd>GPU device.</dd>
1422+
<dt>"<dfn enum-value>npu</dfn>"</dt>
1423+
<dd>A device that's not CPU or GPU and has ML acceleration.</dd>
1424+
</dl>
1425+
14081426
### {{MLGraph/destroy()}} ### {#api-mlgraph-destroy}
14091427

14101428
The {{MLGraph/destroy()}} method can be called to release all resources associated with the graph.

0 commit comments

Comments
 (0)