Skip to content

define graph.devices #854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1374,8 +1374,15 @@ A {{MLContext}} <dfn for=MLContext lt="is lost|is not lost">is lost</dfn> if its
The {{MLGraph}} interface represents a compiled computational graph. A compiled graph once constructed is immutable and cannot be subsequently changed.

<script type=idl>
enum MLDeviceType {
"cpu",
"gpu",
"npu"
};

[SecureContext, Exposed=(Window, Worker)]
interface MLGraph {
readonly attribute FrozenArray<MLDeviceType> devices;
undefined destroy();
};
</script>
Expand Down Expand Up @@ -1405,6 +1412,17 @@ interface MLGraph {
</dl>
</div>

### {{MLGraph/devices}} ### {#api-mlgraph-devices}
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:
<dl dfn-for="MLDeviceType">
<dt>"<dfn enum-value>cpu</dfn>"</dt>
<dd>CPU devices.</dd>
<dt>"<dfn enum-value>gpu</dfn>"</dt>
<dd>GPU devices.</dd>
<dt>"<dfn enum-value>npu</dfn>"</dt>
<dd>Devices that are not CPU or GPU and have ML acceleration.</dd>
</dl>

### {{MLGraph/destroy()}} ### {#api-mlgraph-destroy}

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