Skip to content

Commit c6792df

Browse files
committed
Fix slice algorithm slice size
1 parent 5027d85 commit c6792df

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

index.bs

+8-6
Original file line numberDiff line numberDiff line change
@@ -8845,16 +8845,18 @@ partial dictionary MLOpSupportLimits {
88458845
1. Let |inputShape| be |input|'s [=MLOperand/shape=] and |inputRank| be |input|'s [=MLOperand/rank=].
88468846
1. Let |outputShape| be a new [=/list=].
88478847
1. [=list/For each=] |index| in [=the range=] 0 to |inputRank|, exclusive:
8848-
1. If |sizes|[|index|] is 0, then [=exception/throw=] a {{TypeError}}.
8848+
1. Let |inputSize| be |inputShape|[|index|].
8849+
1. Let |inputSliceSize| be |sizes|[|index|].
8850+
1. Let |stride| be |strides|[|index|] if it is not empty, or 1 otherwise:
8851+
1. If |inputSliceSize| is 0, then [=exception/throw=] a {{TypeError}}.
88498852

88508853
Issue(391): If 0-size dimensions are allowed, revise these steps.
88518854

8852-
1. If |starts|[|index|] is greater than |inputShape|[|index|], then [=exception/throw=] a {{TypeError}}.
8853-
1. If |starts|[|index|] + |sizes|[|index|] is greater than |inputShape|[|index|], then [=exception/throw=] a {{TypeError}}.
8854-
1. Let |stride| be |strides|[|index|] if it is not empty, or 1 otherwise:
88558855
1. If |stride| is less than 1, then [=exception/throw=] a {{TypeError}}.
8856-
1. Let |outputSizeRoundingExcess| be 1 if |inputShape|[|index|] % |stride| != 0, or 0 otherwise.
8857-
1. Let |outputSize| be |inputShape|[|index|] / |stride| + |outputSizeRoundingExcess|
8856+
1. If |starts|[|index|] is greater than |inputSize|, then [=exception/throw=] a {{TypeError}}.
8857+
1. If |starts|[|index|] + |inputSliceSize| is greater than |inputSize|, then [=exception/throw=] a {{TypeError}}.
8858+
1. Let |outputSizeRoundingExcess| be 1 if |inputSliceSize| % |stride| != 0, or 0 otherwise.
8859+
1. Let |outputSize| be |inputSliceSize| / |stride| + |outputSizeRoundingExcess|
88588860
1. [=list/Append=] |outputSize| to |outputShape|.
88598861
1. Let |outputDesc| be the result of [=creating an MLOperandDescriptor=] given |input|'s [=MLOperand/dataType=] and |outputShape|.
88608862
1. *Make graph connections:*

0 commit comments

Comments
 (0)