Skip to content

Commit

Permalink
pull axes validation back out of size calc
Browse files Browse the repository at this point in the history
  • Loading branch information
inexorabletash committed Feb 26, 2024
1 parent 1a7d860 commit f66b135
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -1215,6 +1215,7 @@ partial interface MLGraphBuilder {
</summary>
<div class=algorithm-steps>
1. [=Assert=]: |op| is one of "argMin", "argMax".
1. If |options|.{{MLArgMinMaxOptions/axes}} is given, then if any its [=list/items=] are not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, return failure.
1. Let |outputShape| be the result of [=MLGraphBuilder/calculating reduction output sizes=] given |input|'s [=MLOperand/shape=], |options|.{{MLArgMinMaxOptions/axes}} (if it [=map/exists=]), and |options|.{{MLArgMinMaxOptions/keepDimensions}}. If that returns failure, then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
1. Let |desc| be a new {{MLOperandDescriptor}}.
1. Set |desc|.{{MLOperandDescriptor/dataType}} to {{MLOperandDataType/"int64"}}.
Expand Down Expand Up @@ -4892,7 +4893,6 @@ partial interface MLGraphBuilder {
</summary>
<div class=algorithm-steps>
1. Let |inputSize| be |inputShape|'s [=list/size=].
1. If |axes| is given, then if any its [=list/items=] are not in [=the range=] 0 to |inputSize|, exclusive, return failure.
1. If |axes| is not given, let |axes| be [=the range=] 0 to |inputSize|, exclusive.
1. If |keepDimensions| is true, then:
1. Let |outputShape| be a [=list/clone=] of |inputShape|.
Expand All @@ -4912,6 +4912,7 @@ partial interface MLGraphBuilder {
</summary>
<div class=algorithm-steps>
1. [=Assert=]: |op| is one of "reduceL1", "reduceL2", "reduceLogSum", "reduceLogSumExp", "reduceMax", "reduceMean", "reduceMin", "reduceProduct", "reduceSum", "reduceSumSquare".
1. If |options|.{{MLReduceOptions/axes}} is given, then if any its [=list/items=] are not in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive, return failure.
1. Let |outputShape| be the result of [=MLGraphBuilder/calculating reduction output sizes=] given |input|'s [=MLOperand/shape=], |options|.{{MLReduceOptions/axes}} (if it [=map/exists=]), and |options|.{{MLReduceOptions/keepDimensions}}. If that returns failure, then [=exception/throw=] a "{{DataError}}" {{DOMException}}.
1. Let |desc| be a new {{MLOperandDescriptor}}.
1. Set |desc|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
Expand Down

0 comments on commit f66b135

Please sign in to comment.