From 104d6cf3afb32f50e6056701e231afe6a7433023 Mon Sep 17 00:00:00 2001 From: Austin Sullivan Date: Thu, 6 Jun 2024 09:42:19 -0700 Subject: [PATCH 1/3] remove a few MLActivations definitely not used for recurrent ops --- index.bs | 59 +------------------------------------------------------- 1 file changed, 1 insertion(+), 58 deletions(-) diff --git a/index.bs b/index.bs index 8552a769..cd061ae4 100644 --- a/index.bs +++ b/index.bs @@ -640,7 +640,7 @@ The {{MLGraphBuilder}} interface serves as a builder (factory) to construct a [= In WebNN, a [=computational graph=] is composed of operators 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 input values for inference, constants (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 input is one or more {{MLOperand}}s. An [=operator=]'s output is one or more {{MLOperand}}s. [=Operators=] have operator-specific parameters that control their behavior, which can include zero or more activation functions, which are {{MLActivation}}s. -A key part of the {{MLGraphBuilder}} interface are methods such as {{MLGraphBuilder/gemm()}} and {{MLGraphBuilder/softmax(axis)|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}}. +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}}. 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). @@ -1603,7 +1603,6 @@ dictionary MLClampOptions { partial interface MLGraphBuilder { MLOperand clamp(MLOperand input, optional MLClampOptions options = {}); - MLActivation clamp(optional MLClampOptions options = {}); }; @@ -1674,23 +1673,6 @@ partial interface MLGraphBuilder { 1. Return |output|. -#### {{MLGraphBuilder/clamp(options)}} #### {#api-mlgraphbuilder-clamp-options} -
- **Arguments:** - - *options*: an optional {{MLClampOptions}}. The optional parameters of the operation. - **Returns:** - - an {{MLActivation}}. The operator representing the clamp operation. -
- -
- - The clamp(|options|) method steps are: - - 1. If [=checking clamp options=] given |options| returns false, then [=exception/throw=] a {{TypeError}}. - 1. Let |op| be the result of [=creating an MLActivation=] given [=this=], "clamp" and |options|. - 1. Return |op|. -
- ### concat ### {#api-mlgraphbuilder-concat} Concatenates the input tensors along a given axis. @@ -2825,23 +2806,6 @@ partial interface MLGraphBuilder { 1. Return |output|. -#### {{MLGraphBuilder/gelu()}} #### {#api-mlgraphbuilder-gelu} -
- **Arguments:** - - None. - - **Returns:** - - an {{MLActivation}}. The activation function representing the gelu operation. -
- -
- - The gelu() method steps are: - - 1. Let |op| be the result of [=creating an MLActivation=] given [=this=] and "gelu". - 1. Return |op|. -
- ### gemm ### {#api-mlgraphbuilder-gemm} Calculate the [general matrix multiplication of the Basic Linear Algebra Subprograms](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3). The calculation follows the expression `alpha * A * B + beta * C`, where `A` is a 2-D tensor with shape [M, K] or [K, M], `B` is a 2-D tensor with shape [K, N] or [N, K], and `C` is [=unidirectionally broadcastable=] to the shape [M, N]. `A` and `B` may optionally be transposed prior to the calculation. @@ -5334,7 +5298,6 @@ the N-D input tensor along the given axis. @@ -5382,26 +5345,6 @@ partial interface MLGraphBuilder { 1. Return |output|. -#### {{MLGraphBuilder/softmax(axis)}} #### {#api-mlgraphbuilder-softmax-axis} -
- **Arguments:** - - None. - - **Returns:** - - an {{MLActivation}}. The activation function representing the softmax operation. -
- -
- - The softmax(|axis|) method steps are: - - 1. Let |validationSteps| given {{MLOperandDescriptor}} |descriptor| be these steps: - 1. If |axis| is greater than or equal to |descriptor|.{{MLOperandDescriptor/dimensions}}'s [=list/size=], then return false; - 1. Otherwise, return true. - 1. Let |op| be the result of [=creating an MLActivation=] given [=this=], "softmax", «[ "axis" → |axis| ]», and |validationSteps|. - 1. Return |op|. -
- ### softplus ### {#api-mlgraphbuilder-softplus-method} Compute the softplus function of the input tensor. The calculation follows the expression `ln(1 + exp(x))`. @@ -2798,6 +2799,23 @@ partial interface MLGraphBuilder { 1. Return |output|. +#### {{MLGraphBuilder/gelu()}} #### {#api-mlgraphbuilder-gelu} +
+ **Arguments:** + - None. + + **Returns:** + - an {{MLActivation}}. The activation function representing the gelu operation. +
+ +
+ + The gelu() method steps are: + + 1. Let |op| be the result of [=creating an MLActivation=] given [=this=] and "gelu". + 1. Return |op|. +
+ ### gemm ### {#api-mlgraphbuilder-gemm} Calculate the [general matrix multiplication of the Basic Linear Algebra Subprograms](https://en.wikipedia.org/wiki/Basic_Linear_Algebra_Subprograms#Level_3). The calculation follows the expression `alpha * A * B + beta * C`, where `A` is a 2-D tensor with shape [M, K] or [K, M], `B` is a 2-D tensor with shape [K, N] or [N, K], and `C` is [=unidirectionally broadcastable=] to the shape [M, N]. `A` and `B` may optionally be transposed prior to the calculation.