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
1. If [=MLGraphBuilder/validating operand=] with [=this=] and |input| returns false, then [=exception/throw=] a {{TypeError}}.
8839
8839
1. If any of |sizes|'s [=list/items=] are 0, then [=exception/throw=] a {{TypeError}}.
8840
8840
1. If |starts|'s [=list/size=] and |sizes|'s [=list/size=] are not both equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}.
8841
+
1. Let |strides| be a new [=/list=].
8841
8842
1. If |options|.{{MLSliceOptions/strides}} [=map/exists=]:
8842
-
1. If |options|.{{MLSliceOptions/strides}}'s [=list/size=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}.
8843
-
1. [=list/For each=] |index| in [=the range=] 0 to |input|'s [=MLOperand/rank=], exclusive:
8843
+
1. Set |strides| to |options|.{{MLSliceOptions/strides}}.
8844
+
1. If |strides|'s [=list/size=] is not equal to |input|'s [=MLOperand/rank=], then [=exception/throw=] a {{TypeError}}.
8845
+
1. Let |inputShape| be |input|'s [=MLOperand/shape=] and |inputRank| be |input|'s [=MLOperand/rank=].
8846
+
1. Let |outputShape| be a new [=/list=].
8847
+
1. [=list/For each=] |index| in [=the range=] 0 to |inputRank|, exclusive:
8844
8848
1. If |sizes|[|index|] is 0, then [=exception/throw=] a {{TypeError}}.
8845
8849
8846
8850
Issue(391): If 0-size dimensions are allowed, revise these steps.
8847
8851
8848
-
1. If |starts|[|index|] is greater than or equal to |input|'s [=MLOperand/shape=][|index|], then [=exception/throw=] a {{TypeError}}.
8849
-
1. If |starts|[|index|] + |sizes|[|index|] is greater than |input|'s [=MLOperand/shape=][|index|], then [=exception/throw=] a {{TypeError}}.
8850
-
1. If |options|.{{MLSliceOptions/strides}}[=map/exists=]:
8851
-
1. If |options|.{{MLSliceOptions/strides}}[|index|] is less than 1, then [=exception/throw=] a {{TypeError}}.
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:
8855
+
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|
8858
+
1. [=list/Append=] |outputSize| to |outputShape|.
8859
+
1. Let |outputDesc| be the result of [=creating an MLOperandDescriptor=] given |input|'s [=MLOperand/dataType=] and |outputShape|.
8852
8860
1. *Make graph connections:*
8853
-
1. Let |output| be the result of [=copying an MLOperand=] given |input|.
8861
+
1. Let |output| be the result of [=creating an MLOperand=] given |outputDesc|.
8854
8862
1. Let |operator| be an [=operator=] for the "slice" operation, given |starts|, |sizes|, and |options|.
8855
8863
1. Set |output|.{{MLOperand/[[operator]]}} to |operator|.
8856
8864
1. Set |operator|'s [=operator/input=] to |input|.
0 commit comments