You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/SpecCodingConventions.md
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -110,6 +110,7 @@ Example:
110
110
* Use "let" to introduce a variable and "set" to update a variable or assign to a property.
111
111
* Use « » notation for literal lists, which helps make it clear that they are not JavaScript arrays.
112
112
* When referring to abstract properties, use the short possessive form `|object|'s [=property=]`. Avoid the wordier `the [=property=] of |object|` form.
113
+
* Use "rank" when describing the number of dimensions of a tensor (e.g. in variable names) rather than the ambiguous "size".
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConv2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}.
1899
1899
1. If |options|.{{MLConv2dOptions/activation}}[=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and it returns false, then [=exception/throw=] a {{TypeError}}.
1900
-
1. Let |inputSize| be |input|'s [=MLOperand/rank=].
1901
-
1. Let |filterSize| be |filter|'s [=MLOperand/rank=].
1902
-
1. If |inputSize| is not 4, then [=exception/throw=] a {{TypeError}}.
1903
-
1. If |filterSize| is not 4, then [=exception/throw=] a {{TypeError}}.
1900
+
1. If |input|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}.
1901
+
1. If |filter|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}.
1904
1902
1. If |input|'s [=MLOperand/dataType=] is not the same as |filter|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
1905
1903
1. If |options|.{{MLConv2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ».
1906
1904
1. Else if |options|.{{MLConv2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}.
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |filter|, and |options|.{{MLConvTranspose2dOptions/bias}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}.
2115
2113
1. If |options|.{{MLConvTranspose2dOptions/activation}}[=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and it returns false, then [=exception/throw=] a {{TypeError}}.
2116
-
1. Let |inputSize| be |input|'s [=MLOperand/rank=].
2117
-
1. Let |filterSize| be |filter|'s [=MLOperand/rank=].
2118
-
1. If |inputSize| is not 4, then [=exception/throw=] a {{TypeError}}.
2119
-
1. If |filterSize| is not 4, then [=exception/throw=] a {{TypeError}}.
2114
+
1. If |input|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}.
2115
+
1. If |filter|'s [=MLOperand/rank=] is not 4, then [=exception/throw=] a {{TypeError}}.
2120
2116
1. If |input|'s [=MLOperand/dataType=] is not the same as |filter|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
2121
2117
1. If |options|.{{MLConvTranspose2dOptions/padding}} does not [=map/exist=], set it to the [=/list=] « 0, 0, 0, 0 ».
2122
2118
1. Else if |options|.{{MLConvTranspose2dOptions/padding}}'s [=list/size=] is not 4, then [=exception/throw=] a {{TypeError}}.
To <dfn for="MLGraphBuilder">calculate reduction output sizes</dfn>, given a [=/list=] of unsigned integers |inputShape|, a optional [=/list=] of unsigned integers |axes|, and [=/boolean=] |keepDimensions|, perform the following steps. They return a new [=/list=] of unsigned integers.
4757
4751
</summary>
4758
-
1. Let |inputSize| be |inputShape|'s [=list/size=].
4759
-
1. If |axes| is not given, let |axes| be [=the range=] 0 to |inputSize|, exclusive.
4752
+
1. Let |inputRank| be |inputShape|'s [=list/size=].
4753
+
1. If |axes| is not given, let |axes| be [=the range=] 0 to |inputRank|, exclusive.
4760
4754
1. If |keepDimensions| is true, then:
4761
4755
1. Let |outputShape| be a [=list/clone=] of |inputShape|.
4762
4756
1. [=list/For each=] |axis| of |axes|:
4763
4757
1. Set |outputShape|[|axis|] to 1.
4764
4758
1. Otherwise:
4765
4759
1. Let |outputShape| be an empty [=/list=].
4766
-
1. [=list/For each=] |index| in [=the range=] 0 to |inputSize|, exclusive:
4760
+
1. [=list/For each=] |index| in [=the range=] 0 to |inputRank|, exclusive:
4767
4761
1. If |axes| does not [=list/contain=] |index|, then [=list/append=] |inputShape|[|index|].
0 commit comments