Skip to content

Commit 295cd0b

Browse files
Varioius fixes
- gemm(): Fix ranks in table, align phrasing. - gru(): Align phrasing. - lstm(): Don't inline rank of 3, reference table. - matmul(): Align phrasing. - prelu(): Fix punctation. - triangular(): Add table, use for rank validation. - where(): Align phrasing.
1 parent 12127a0 commit 295cd0b

File tree

1 file changed

+25
-14
lines changed

1 file changed

+25
-14
lines changed

index.bs

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3056,11 +3056,11 @@ partial interface MLGraphBuilder {
30563056
<tr>
30573057
<td>{{a}}
30583058
<td>{{MLOperandDataType/"float32"}}, {{MLOperandDataType/"float16"}}
3059-
<td>[=/any rank|N=]
3059+
<td>2
30603060
<tr>
30613061
<td>{{b}}
30623062
<td>[=/same as=] {{a}}
3063-
<td>[=/any rank|N=]
3063+
<td>2
30643064
<tr>
30653065
<td>{{MLGemmOptions/c}}
30663066
<td>[=/same as=] {{a}}
@@ -3073,9 +3073,8 @@ partial interface MLGraphBuilder {
30733073
The <dfn method for=MLGraphBuilder>gemm(|a|, |b|, |options|)</dfn> method steps are:
30743074
</summary>
30753075
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}.
3076-
1. If |a|'s [=MLOperand/dataType=] is one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
3077-
1. If |b|'s [=MLOperand/dataType=] is one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
3078-
1. If |a|'s [=MLOperand/rank=] is not 2 or |b|'s [=MLOperand/rank=] is not 2, then [=exception/throw=] a {{TypeError}}.
3076+
1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
3077+
1. If the [=MLOperand/rank=] of any of |a| or |b| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}.
30793078
1. Let |shapeA| be a [=list/clone=] of |a|'s [=MLOperand/shape=].
30803079
1. Let |shapeB| be a [=list/clone=] of |b|'s [=MLOperand/shape=].
30813080
1. If |options|.{{MLGemmOptions/aTranspose}} is true, then reverse the order of the items in |shapeA|.
@@ -3238,7 +3237,7 @@ partial interface MLGraphBuilder {
32383237
</summary>
32393238
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLGruOptions/bias}} (if it [=map/exists=]), |options|.{{MLGruOptions/recurrentBias}} (if it [=map/exists=]), and |options|.{{MLGruOptions/initialHiddenState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}.
32403239
1. If |options|.{{MLGruOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}.
3241-
1. If the [=MLOperand/dataType=] of either |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
3240+
1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
32423241
1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}.
32433242
1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}.
32443243
1. Let |batchSize| be |input|'s [=MLOperand/shape=][1].
@@ -4347,7 +4346,7 @@ partial interface MLGraphBuilder {
43474346
1. If |options|.{{MLLstmOptions/activations}} [=map/exists=], and [=MLGraphBuilder/validating activation=] with [=this=] and any [=list/item=] in it returns false, then [=exception/throw=] a {{TypeError}}.
43484347
1. Let |numDirections| be 2 if |options|.{{MLLstmOptions/direction}} is {{MLRecurrentNetworkDirection/"both"}}, or 1 otherwise.
43494348
1. If the [=MLOperand/dataType=] of any of |input|, |weight| or |recurrentWeight| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
4350-
1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not 3, then [=exception/throw=] a {{TypeError}}.
4349+
1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not its [=allowed rank=], then [=exception/throw=] a {{TypeError}}.
43514350
1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}.
43524351
1. Let |batchSize| be |input|'s [=MLOperand/shape=][1].
43534352
1. Let |inputSize| be |input|'s [=MLOperand/shape=][2].
@@ -4836,8 +4835,7 @@ partial interface MLGraphBuilder {
48364835
The <dfn method for=MLGraphBuilder>matmul(|a|, |b|)</dfn> method steps are:
48374836
</summary>
48384837
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |a| and |b| returns false, then [=exception/throw=] a {{TypeError}}.
4839-
1. If |a|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.,
4840-
1. If |b|'s [=MLOperand/dataType=] is not equal to |a|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
4838+
1. If the [=MLOperand/dataType=] of any of |a| or |b| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
48414839
1. Let |desc| be a new {{MLOperandDescriptor}}.
48424840
1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the result of [=MLGraphBuilder/calculating matmul output sizes=] given |a| and |b|.
48434841
1. If that throws an error, re-[=exception/throw=] the error.
@@ -5219,7 +5217,7 @@ partial interface MLGraphBuilder {
52195217
The <dfn method for=MLGraphBuilder>prelu(|input|, |slope|)</dfn> method steps are:
52205218
</summary>
52215219
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input| and |slope| returns false, then [=exception/throw=] a {{TypeError}}.
5222-
1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.,
5220+
1. If the [=MLOperand/dataType=] of any of |input| or |slope| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
52235221
1. Let |descriptor| be a new {{MLOperandDescriptor}}.
52245222
1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
52255223
1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the result of [=unidirectionally broadcasting the shapes=] |slope|'s [=MLOperand/shape=] and |input|'s [=MLOperand/shape=].
@@ -6242,7 +6240,7 @@ partial interface MLGraphBuilder {
62426240
</summary>
62436241
1. If |options|.{{MLTransposeOptions/permutation}} does not [=map/exist=], let |options|.{{MLTransposeOptions/permutation}} be the reversed sequence of all indices for |input|'s [=MLOperand/shape=].
62446242
1. Otherwise if |options|.{{MLTransposeOptions/permutation}} [=map/exists=]:
6245-
1. If its [=MLOperand/rank=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}.
6243+
1. If its [=list/size=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}.
62466244
1. If its values are not in [=the range=] 0 to |input|'s [=MLOperand/rank=] exclusive, then [=exception/throw=] a {{TypeError}}.
62476245
1. If it contains duplicate values, then [=exception/throw=] a {{TypeError}}.
62486246
1. *Make graph connections:*
@@ -6286,11 +6284,25 @@ partial interface MLGraphBuilder {
62866284
**Returns:** an {{MLOperand}}. The output tensor representing a triangular matrix, or batch of matrices which is the same shape as the input.
62876285
</div>
62886286

6287+
<table class='data' link-for="MLGraphBuilder/triangular(input, options)">
6288+
<thead class=stickyheader>
6289+
<tr>
6290+
<th>input operand
6291+
<th>[=/allowed data types=]
6292+
<th>[=/allowed ranks=]
6293+
</thead>
6294+
<tr>
6295+
<td>{{input}}
6296+
<td>[=/any data type|any=]
6297+
<td>2 or greater
6298+
</table>
6299+
6300+
62896301
<details open algorithm>
62906302
<summary>
62916303
The <dfn method for=MLGraphBuilder>triangular(|input|, |options|)</dfn> method steps are:
62926304
</summary>
6293-
1. If |input|'s [=MLOperand/rank=] is less than 2, then [=exception/throw=] a {{TypeError}}.
6305+
1. If |input|'s [=MLOperand/rank=] is not one of its [=allowed ranks=], then [=exception/throw=] a {{TypeError}}.
62946306
1. *Make graph connections:*
62956307
1. Let |output| be the result of [=copying an MLOperand=] given |input|.
62966308
1. Let |operator| be an [=operator=] for the triangular operation, given |options|.
@@ -6408,8 +6420,7 @@ partial interface MLGraphBuilder {
64086420
<summary>
64096421
The <dfn method for=MLGraphBuilder>where(|condition|, |input|, |other|)</dfn> method steps are:
64106422
</summary>
6411-
1. If |condition|'s [=MLOperand/dataType=] is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
6412-
1. If |input|'s [=MLOperand/dataType=] is not equal to |other|'s [=MLOperand/dataType=], then [=exception/throw=] a {{TypeError}}.
6423+
1. If the [=MLOperand/dataType=] of any of |condition|, |input|, or |other| is not one of its [=allowed data types=], then [=exception/throw=] a {{TypeError}}.
64136424
1. Let |descriptor| be a new {{MLOperandDescriptor}}.
64146425
1. Set |descriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
64156426
1. Set |descriptor|.{{MLOperandDescriptor/dimensions}} to the result of [=bidirectionally broadcasting the shapes=] |input|'s [=MLOperand/shape=] and |other|'s [=MLOperand/shape=].

0 commit comments

Comments
 (0)