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 its [=MLOperand/rank=] is not 3, then [=exception/throw=] a {{TypeError}}.
3088
3088
1. If |options|.{{MLGruOptions/activations}}[=map/exists=] and its [=list/size=] is not 2, then [=exception/throw=] a {{TypeError}}.
3089
3089
1. If |steps| is not equal to |input|'s [=MLOperand/shape=][0], then [=exception/throw=] a {{TypeError}}.
3090
+
1. Let |batchSize| be |input|'s [=MLOperand/shape=][1].
3091
+
1. Let |numDirections| be 2 if |options|.{{MLGruOptions/direction}} is {{MLRecurrentNetworkDirection/"both"}}, or 1 otherwise.
3092
+
1. If |options|.{{MLGruOptions/activations}}[=map/exists=]:
3093
+
1. Let |gateDescriptor| be a new {{MLOperandDescriptor}}.
3094
+
1. Set |gateDescriptor|.{{MLOperandDescriptor/dimensions}} to « |batchSize|, |hiddenSize| ».
3095
+
1. Set |gateDescriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
3096
+
1. If running the [=MLActivation/validation steps=] of any [=list/item=] in |options|.{{MLGruOptions/activations}} with |gateDescriptor| returns false, then [=exception/throw=] a {{TypeError}}.
3090
3097
1. *Calculate the output shape:*
3091
3098
1. Let |desc0| be a new {{MLOperandDescriptor}}.
3092
3099
1. Set |desc0|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |numDirections|, |batchSize|, |hiddenSize| ».
1. Set |desc1|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
3097
3104
1. Set |desc1|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |steps|, |numDirections|, |batchSize|, |hiddenSize| ».
3098
-
1. If running the [=MLActivation/validation steps=] of any [=list/item=] in |options|.{{MLGruOptions/activations}} with |desc0| returns false, then [=exception/throw=] a {{TypeError}}.
3099
3105
1. *Make graph connections:*
3100
3106
1. Let |operator| be an [=operator=] for "gru", given |weight|, |recurrentWeight|, |steps|, |hiddenSize| and |options| as parameters.
3101
3107
1. Let |output0| be the result of [=creating an MLOperand=] given [=this=] and |desc0|.
1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |input|'s [=MLOperand/shape=][0], |hiddenSize| ».
3260
3266
1. Set |desc|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
3261
-
1. If running the [=MLActivation/validation steps=] of any [=list/item=] in |options|.{{MLGruCellOptions/activations}} with |desc| returns false, then [=exception/throw=] a {{TypeError}}.
3267
+
1. If |options|.{{MLGruCellOptions/activations}}[=map/exists=], and running the [=MLActivation/validation steps=] of any [=list/item=] in it with |desc| returns false, then [=exception/throw=] a {{TypeError}}.
3262
3268
1. *Make graph connections:*
3263
3269
1. Let |output| be the result of [=creating an MLOperand=] given [=this=] and |desc|.
3264
3270
1. Let |operator| be an [=operator=] for "gruCell", given |weight|, |recurrentWeight|, |hiddenState|, |hiddenSize| and |options| as parameters.
3265
3271
1. Set |output|.{{MLOperand/[[operator]]}} to |operator|.
3266
3272
1. Set |operator|'s [=operator/inputs=] to |input|, |weight|, |recurrentWeight|, and |hiddenState|.
3267
3273
1. If |options|.{{MLGruCellOptions/bias}}[=map/exists=], then add it to |operator|'s [=operator/inputs=].
3268
3274
1. If |options|.{{MLGruCellOptions/recurrentBias}}[=map/exists=], then add it to |operator|'s [=operator/inputs=].
3269
-
1. Add |options|.{{MLGruCellOptions/activations}} to |operator|'s [=operator/activation functions=].
3275
+
1. If |options|.{{MLGruCellOptions/activations}}[=map/exists=], then add it to |operator|'s [=operator/activation functions=].
3270
3276
1. Set |operator|'s [=operator/output=] to |output|.
1. If [=MLGraphBuilder/validating operand=] with [=this=] and any of |input|, |weight|, |recurrentWeight|, |options|.{{MLLstmOptions/bias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/recurrentBias}} (if it [=map/exists=]), |options|.{{MLLstmOptions/peepholeWeight}} (if it [=map/exists=]), |options|.{{MLLstmOptions/initialHiddenState}} (if it [=map/exists=]), and |options|.{{MLLstmOptions/initialCellState}} (if it [=map/exists=]) returns false, then [=exception/throw=] a {{TypeError}}.
3971
3977
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}}.
3972
-
1. Let |numDirections| be 1 if |options|.{{MLLstmOptions/direction}} is {{MLRecurrentNetworkDirection/"forward"}}, or otherwise let it be 2.
3978
+
1. Let |numDirections| be 2 if |options|.{{MLLstmOptions/direction}} is {{MLRecurrentNetworkDirection/"both"}}, or 1 otherwise.
3973
3979
1. If the [=MLOperand/rank=] of any of |input|, |weight| or |recurrentWeight| is not 3, then [=exception/throw=] a {{TypeError}}.
3974
3980
1. If |input|'s [=MLOperand/shape=][0] is not equal to |steps|, then [=exception/throw=] a {{TypeError}}.
3975
3981
1. Let |batchSize| be |input|'s [=MLOperand/shape=][1].
1. If its [=MLOperand/shape=][2] is not |hiddenSize|, then [=exception/throw=] a {{TypeError}}.
3998
4004
1. If |options|.{{MLLstmOptions/activations}}[=map/exists=]:
3999
4005
1. If its [=list/size=] is not 3, then [=exception/throw=] a {{TypeError}}.
4006
+
1. Let |gateDescriptor| be a new {{MLOperandDescriptor}}.
4007
+
1. Set |gateDescriptor|.{{MLOperandDescriptor/dimensions}} to [=/list=] « |batchSize|, |hiddenSize| ».
4008
+
1. Set |gateDescriptor|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
4009
+
1. If running the [=MLActivation/validation steps=] of any [=list/item=] in |options|.{{MLLstmOptions/activations}}[=map/exists=] with |gateDescriptor| returns false, then [=exception/throw=] a {{TypeError}}.
4000
4010
1. *Calculate the output shape:*
4001
4011
1. Let |desc| be a new {{MLOperandDescriptor}}.
4002
4012
1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |numDirections|, |batchSize|, |hiddenSize| ».
1. Set |desc2|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
4007
4017
1. Set |desc2|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |steps|, |numDirections|, |batchSize|, |hiddenSize| ».
4008
-
1. If running the [=MLActivation/validation steps=] of any [=list/item=] in |options|.{{MLLstmOptions/activations}} with |desc| returns false, then [=exception/throw=] a {{TypeError}}.
4009
4018
1. *Make graph connections:*
4010
4019
1. Let |operator| be an [=operator=] for the LSTM operation, given |weight|, |recurrentWeight|, |steps|, |hiddenSize| and |options|.
4011
4020
1. Let |output0| be the result of [=creating an MLOperand=] given [=this=] and |desc|.
1. Set |desc|.{{MLOperandDescriptor/dimensions}} to the [=/list=] « |batchSize|, |hiddenSize| ».
4196
4205
1. Set |desc|.{{MLOperandDescriptor/dataType}} to |input|'s [=MLOperand/dataType=].
4197
-
1. If running the [=MLActivation/validation steps=] of any [=list/item=] in |options|.{{MLLstmCellOptions/activations}} with |desc| returns false, then [=exception/throw=] a {{TypeError}}.
4206
+
1. If |options|.{{MLLstmCellOptions/activations}}[=map/exists=], and running the [=MLActivation/validation steps=] of any [=list/item=] in it with |desc| returns false, then [=exception/throw=] a {{TypeError}}.
4198
4207
1. *Make graph connections:*
4199
4208
1. Let |output0| be the result of [=creating an MLOperand=] given [=this=] and |desc|.
4200
4209
1. Let |output1| be the result of [=creating an MLOperand=] given [=this=] and |desc|.
0 commit comments