I watched the this video on YouTube and copied the code. Why it does not work in M12? I mean net[inData]
and rnnLayerForward[param, inData, state]
don't give the same result? What change since then and how can I fix it? Slides can be downloaded here.
rnnTimeStep[params_Association, input_, state_] :=
Tanh[params["StateWeights"].state + params["InputWeights"].input +
params["Biases"]];
rnnLayerForward[params_Association, input_, state_] :=
Rest@FoldList[rnnTimeStep[params, #2, #1] &, state, input]
sequenceLength = 3;
featureSize = 2;
rnnStateSize = 1;
inData = RandomReal[1, {sequenceLength, featureSize}];
state = ConstantArray[0, rnnStateSize];
net = NetInitialize@
BasicRecurrentLayer[rnnStateSize, "Input" -> Dimensions@inData]
param = Normal@NetExtract[net, "Arrays"]
net[inData]
rnnLayerForward[param, inData, state]
param = Normal[#] & /@ NetExtract[net, "Arrays"]
$\endgroup$param = Normal/@ NetExtract[net, "Arrays"]
is also fine. $\endgroup$