diff --git a/index.bs b/index.bs index 44fc6266..1c2ed851 100644 --- a/index.bs +++ b/index.bs @@ -843,16 +843,6 @@ When the {{MLContext/[[contextType]]}} is set to [=context type/default=] with t :: An object where the keys are the graph output names, and the values are the transferred {{ArrayBufferView}}s for the computed output tensor values. -
- - To validate graph resources, given {{MLNamedArrayBufferViews}} |resources| and [=ordered map=] |descriptors|, run the following steps: - - 1. [=map/For each=] |name| → |resource| of |resources|: - 1. If |descriptors|[|name|] does not [=map/exist=], return false. - 1. If [=validating buffer with descriptor=] given |resource| and |descriptors|[|name|] returns false, then return false. - 1. Return true. -
-
To validate buffer with descriptor given {{ArrayBufferView}} |bufferView| and {{MLOperandDescriptor}} |descriptor|, run the following steps: @@ -916,6 +906,8 @@ In accordance with the [=ArrayBufferView/write|Web IDL warning=], to prevent the **Returns:** Promise<{{MLComputeResult}}>. +Note: Invocations of {{MLContext/compute()}} will fail if any of the {{MLContext/compute(graph, inputs, outputs)/graph}}'s inputs are not provided as {{MLContext/compute(graph, inputs, outputs)/inputs}}, or if any requested {{MLContext/compute(graph, inputs, outputs)/outputs}} do not match the {{MLContext/compute(graph, inputs, outputs)/graph}}'s outputs. +
The compute(|graph|, |inputs|, |outputs|) method steps are: @@ -924,8 +916,12 @@ In accordance with the [=ArrayBufferView/write|Web IDL warning=], to prevent the 1. Let |realm| be [=this=]'s [=relevant realm=]. 1. If |graph|.{{MLGraph/[[context]]}} is not [=this=], then return [=a new promise=] [=rejected=] with a {{TypeError}}. 1. If |graph|.{{MLGraph/[[context]]}}.{{MLContext/[[contextType]]}} is not "[=context type/default=]", then return [=a new promise=] [=rejected=] with an "{{OperationError}}" {{DOMException}}. - 1. If [=validating graph resources=] given |inputs| and |graph|.{{MLGraph/[[inputDescriptors]]}} returns false, then return [=a new promise=] [=rejected=] with a {{TypeError}}. - 1. If [=validating graph resources=] given |outputs| and |graph|.{{MLGraph/[[outputDescriptors]]}} returns false, then return [=a new promise=] [=rejected=] with a {{TypeError}}. + 1. [=map/For each=] |name| → |descriptor| of |graph|.{{MLGraph/[[inputDescriptors]]}}: + 1. If |inputs|[|name|] does not [=map/exist=], then return [=a new promise=] [=rejected=] with a {{TypeError}}. + 1. If [=validating buffer with descriptor=] given |inputs|[|name|] and |descriptor| returns false, then return [=a new promise=] [=rejected=] with a {{TypeError}}. + 1. [=map/For each=] |name| → |resource| of |outputs|: + 1. If |graph|.{{MLGraph/[[outputDescriptors]]}}[|name|] does not [=map/exist=], then return [=a new promise=] [=rejected=] with a {{TypeError}}. + 1. If [=validating buffer with descriptor=] given |resource| and |graph|.{{MLGraph/[[outputDescriptors]]}}[|name|] returns false, then return [=a new promise=] [=rejected=] with a {{TypeError}}. 1. Let |transferredInputs| be the result of [=MLNamedArrayBufferViews/transfer|transferring=] {{MLNamedArrayBufferViews}} |inputs| with |realm|. If that threw an exception, then return [=a new promise=] [=rejected=] with that exception. 1. Let |transferredOutputs| be the result of [=MLNamedArrayBufferViews/transfer|transferring=] {{MLNamedArrayBufferViews}} |outputs| with |realm|. If that threw an exception, then return [=a new promise=] [=rejected=] with that exception. 1. Let |promise| be [=a new promise=].