From 3a9acd5e72910ce2b793216f39922da48b082305 Mon Sep 17 00:00:00 2001 From: Joshua Bell Date: Mon, 29 Jan 2024 11:54:06 -0800 Subject: [PATCH 1/3] Bugfix: Provide default for MLLayerNormalizationOptions axes in steps This adds an explicit algorithm step in layerNormalization() to provide a default described only in prose for the axes option. For #211 --- index.bs | 1 + 1 file changed, 1 insertion(+) diff --git a/index.bs b/index.bs index 3893f415..aeebaa16 100644 --- a/index.bs +++ b/index.bs @@ -3820,6 +3820,7 @@ partial interface MLGraphBuilder { The layerNormalization(|input|, |options|) method steps are:
+ 1. If |options|.{{MLLayerNormalizationOptions/axes}} does not [=map/exist=], set |options|.{{MLLayerNormalizationOptions/axes}} to the [=/list=] « 1, 2, 3 ». 1. If the [=rank=] of |options|.{{MLLayerNormalizationOptions/scale}} is not equal to the [=list/size=] of |options|.{{MLLayerNormalizationOptions/axes}}, then [=exception/throw=] a "{{DataError}}" {{DOMException}}. 1. If the [=rank=] of |options|.{{MLLayerNormalizationOptions/bias}} is not equal to the [=list/size=] of |options|.{{MLLayerNormalizationOptions/axes}}, then [=exception/throw=] a "{{DataError}}" {{DOMException}}. 1. [=list/For each=] |index| in [=the range=] 0 to the [=list/size=] of |options|.{{MLLayerNormalizationOptions/axes}}, exclusive: From d25f23a8cd6877fc90f1f9d8fa9f8608179c391e Mon Sep 17 00:00:00 2001 From: Dwayne Robinson Date: Fri, 9 Feb 2024 16:55:51 -0800 Subject: [PATCH 2/3] Update index.bs Editing wording for 0D and 1D case. --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index aeebaa16..bf8b3ad6 100644 --- a/index.bs +++ b/index.bs @@ -3820,7 +3820,7 @@ partial interface MLGraphBuilder { The layerNormalization(|input|, |options|) method steps are:
- 1. If |options|.{{MLLayerNormalizationOptions/axes}} does not [=map/exist=], set |options|.{{MLLayerNormalizationOptions/axes}} to the [=/list=] « 1, 2, 3 ». + 1. If |options|.{{MLLayerNormalizationOptions/axes}} does not [=map/exist=], then set |options|.{{MLLayerNormalizationOptions/axes}} to a new [=/list=], either equal to [=the range=] from 1 to |input|'s [=rank-=], exclusive, if |input|'s [=rank=] is greater than 1, or an empty [=/list=] otherwise. 1. If the [=rank=] of |options|.{{MLLayerNormalizationOptions/scale}} is not equal to the [=list/size=] of |options|.{{MLLayerNormalizationOptions/axes}}, then [=exception/throw=] a "{{DataError}}" {{DOMException}}. 1. If the [=rank=] of |options|.{{MLLayerNormalizationOptions/bias}} is not equal to the [=list/size=] of |options|.{{MLLayerNormalizationOptions/axes}}, then [=exception/throw=] a "{{DataError}}" {{DOMException}}. 1. [=list/For each=] |index| in [=the range=] 0 to the [=list/size=] of |options|.{{MLLayerNormalizationOptions/axes}}, exclusive: From b6c848976f208884d907bc5d80ea02a5dca16db7 Mon Sep 17 00:00:00 2001 From: Dwayne Robinson Date: Fri, 9 Feb 2024 18:10:53 -0800 Subject: [PATCH 3/3] Update axes prose too --- index.bs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.bs b/index.bs index bf8b3ad6..be9596cb 100644 --- a/index.bs +++ b/index.bs @@ -3800,7 +3800,7 @@ partial interface MLGraphBuilder { : axes :: - The indices to the input dimensions to reduce. When this member is not present, it is assumed to be [1,2,3] that is, the reduction for the mean and variance values are calculated across all the input features for each individual sample in the batch. + The indices to the input dimensions to reduce. When this member is not present, it is treated as if all dimensions except the first were given (e.g. for a 4-D input tensor, axes = [1,2,3]). That is, the reduction for the mean and variance values are calculated across all the input features for each independent batch. : epsilon ::