Skip to content

Commit 78d9d7b

Browse files
committed
inline clamp checks
1 parent 104d6cf commit 78d9d7b

File tree

1 file changed

+2
-10
lines changed

1 file changed

+2
-10
lines changed

index.bs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ The {{MLGraphBuilder}} interface serves as a builder (factory) to construct a [=
640640

641641
In WebNN, a [=computational graph=] is composed of <dfn>operators</dfn> which act on data, and are the nodes of the graph. {{MLOperand}}s are a representation of data that flows within the computational graph, and are the edges of the graph. {{MLOperand}}s include a [=computational graph=]'s <dfn for="computational graph">input</dfn> values for inference, <dfn for="computational graph">constants</dfn> (including trained weights) used for inference, intermediate values (often referred to as activations) computed during inference, as well as the output values of inference. An [=operator=]'s <dfn for=operator>input</dfn> is one or more {{MLOperand}}s. An [=operator=]'s <dfn for=operator>output</dfn> is one or more {{MLOperand}}s. [=Operators=] have operator-specific parameters that control their behavior, which can include zero or more <dfn for=operator lt="activation|activation function">activation functions</dfn>, which are {{MLActivation}}s.
642642

643-
A key part of the {{MLGraphBuilder}} interface are methods such as {{MLGraphBuilder/gemm()}} and {{MLGraphBuilder/softmax()}} which create an [=operator=] which represents the actual operation to perform on the input data when the computation is run, and return a new {{MLOperand}} or {{MLActivation}} holding the operator. Methods that create an {{MLOperand}} connect any [=operator/inputs=] and [=operator/activations=] to the operator. Each method invocation returns a distinct new value, without changing the value of any other {{MLOperand}}.
643+
A key part of the {{MLGraphBuilder}} interface are methods such as {{MLGraphBuilder/gemm()}} and {{MLGraphBuilder/relu()}} which create an [=operator=] which represents the actual operation to perform on the input data when the computation is run, and return a new {{MLOperand}} or {{MLActivation}} holding the operator. Methods that create an {{MLOperand}} connect any [=operator/inputs=] and [=operator/activations=] to the operator. Each method invocation returns a distinct new value, without changing the value of any other {{MLOperand}}.
644644

645645
At inference time, every {{MLOperand}} will be bound to a tensor (the actual data), which are essentially multidimensional arrays. The representation of the tensors is implementation dependent, but it typically includes the array data stored in some buffer (memory) and some metadata describing the array data (such as its shape).
646646

@@ -1641,14 +1641,6 @@ partial interface MLGraphBuilder {
16411641
</details>
16421642
</div>
16431643

1644-
<details open algorithm>
1645-
<summary>
1646-
To <dfn>check clamp options</dfn> given {{MLClampOptions}} |options|, run the following steps:
1647-
</summary>
1648-
1. If |options|.{{MLClampOptions/minValue}} is greater than |options|.{{MLClampOptions/maxValue}}, then return false.
1649-
1. Return true.
1650-
</details>
1651-
16521644
#### {{MLGraphBuilder/clamp(input, options)}} #### {#api-mlgraphbuilder-clamp-operand-options}
16531645
<div>
16541646
**Arguments:**
@@ -1663,7 +1655,7 @@ partial interface MLGraphBuilder {
16631655
The <dfn method for=MLGraphBuilder>clamp(|input|, |options|)</dfn> method steps are:
16641656
</summary>
16651657
1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}.
1666-
1. If [=checking clamp options=] given |options| returns false, then [=exception/throw=] a {{TypeError}}.
1658+
1. If |options|.{{MLClampOptions/minValue}} is greater than |options|.{{MLClampOptions/maxValue}}, then [=exception/throw=] a {{TypeError}}.
16671659
1. *Make graph connections:*
16681660
1. Let |output| be the result of [=copying an MLOperand=] given |input|.
16691661
1. Let |operator| be an [=operator=] for the "clamp" operation, given |options|.{{MLClampOptions/minValue}} and |options|.{{MLClampOptions/maxValue}}.

0 commit comments

Comments
 (0)