Skip to content

Commit

Permalink
Expose WebNN API to shared workers and service workers
Browse files Browse the repository at this point in the history
  • Loading branch information
inexorabletash committed Feb 24, 2025
1 parent 9f58451 commit b76d7aa
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ API {#api}

## The navigator.ml interface ## {#api-navigator-ml}

An {{ML}} object is available in the {{Window}} and {{DedicatedWorkerGlobalScope}} contexts through the {{Navigator}}
An {{ML}} object is available in the {{Window}} and {{WorkerGlobalScope}} contexts through the {{Navigator}}
and {{WorkerNavigator}} interfaces respectively and is exposed via `navigator.ml`.

<script type=idl>
Expand All @@ -780,7 +780,7 @@ dictionary MLContextOptions {
MLPowerPreference powerPreference = "default";
};

[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface ML {
Promise<MLContext> createContext(optional MLContextOptions options = {});
Promise<MLContext> createContext(GPUDevice gpuDevice);
Expand Down Expand Up @@ -865,7 +865,7 @@ dictionary MLContextLostInfo {
DOMString message;
};

[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLContext {
undefined dispatch(MLGraph graph, MLNamedTensors inputs, MLNamedTensors outputs);

Expand Down Expand Up @@ -1284,7 +1284,7 @@ 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>
[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLGraph {
undefined destroy();
};
Expand Down Expand Up @@ -1418,7 +1418,7 @@ An {{MLOperand}} represents an intermediary graph being constructed as a result
For instance, an {{MLOperand}} can represent a constant feeding to an operation or the result from combining multiple constants together into an operation. See also [[#programming-model]].

<script type=idl>
[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLOperand {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
Expand Down Expand Up @@ -1542,7 +1542,7 @@ The {{MLTensor}} interface represents a tensor which may be used as an input or
The [=implementation-defined=] requirements of how an {{MLTensor}} is allocated may include constraints such as that the memory is allocated with a particular byte alignment or in a particular memory pool.

<script type=idl>
[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLTensor {
readonly attribute MLOperandDataType dataType;
readonly attribute FrozenArray<unsigned long> shape;
Expand Down Expand Up @@ -1629,7 +1629,7 @@ The {{MLGraphBuilder}} interface defines a set of operations as identified by th
<script type=idl>
typedef record<USVString, MLOperand> MLNamedOperands;

[SecureContext, Exposed=(Window, DedicatedWorker)]
[SecureContext, Exposed=(Window, Worker)]
interface MLGraphBuilder {
// Construct the graph builder from the context.
constructor(MLContext context);
Expand Down

0 comments on commit b76d7aa

Please sign in to comment.