Hi,
I was referring to the Simple LSTM tutorial, which combines classifier(Dense layer) with LSTMCell using AbstractExplicitContainerLayer.
Also, in my case I am passing explicit parameters to the neural net.
NN = Lux.Chain(Lux.Dense(3, 6, relu),
Lux.Dense(6, 2, relu))
NNparams, st = Lux.setup(rng, NN)
parameters = ComponentArray(NNparams = NNparams, uhat = uhat)
u_hat = NN(u, parameters.NNparams, states.st)[1] # Network prediction
#This works for neural net.
I tried to update the network using LSTMCell, however it does not work, seems to be arguments and definition error.
NN = Lux.Chain(Lux.Dense(3 => 3),
Lux.StatefulRecurrentCell(Lux.LSTMCell(3 => 6)),
Lux.Dense(6 => 2))
# NN = Lux.Chain(Lux.Dense(3 => 3),
# Lux.Recurrent(Lux.LSTMCell(3 => 6)),
# Lux.Dense(6 => 2))
MethodError: no method matching (::LSTMCell{true, false, false, Tuple{typeof(WeightInitializers.zeros32), typeof(WeightInitializers.zeros32), typeof(WeightInitializers.ones32), typeof(WeightInitializers.zeros32)}, NTuple{4, typeof(glorot_uniform)}, typeof(WeightInitializers.zeros32), typeof(WeightInitializers.zeros32)})(::Vector{Float64}, ::ComponentVector{Float64, SubArray{Float64, 1, Vector{Float64}, Tuple{UnitRange{Int64}}, true}, Tuple{Axis{(weight_i = ViewAxis(1:72, ShapedAxis((24, 3), NamedTuple())), weight_h = ViewAxis(73:216, ShapedAxis((24, 6), NamedTuple())), bias = ViewAxis(217:240, ShapedAxis((24, 1), NamedTuple())))}}}, ::@NamedTuple{rng::StableRNGs.LehmerRNG})
Closest candidates are:
(::LSTMCell{use_bias, false, false})(!Matched::AbstractMatrix, ::Any, ::NamedTuple) where use_bias
@ Lux C:\Users\rathorek\.julia\packages\Lux\5xfGO\src\layers\recurrent.jl:397
(::LSTMCell{true})(!Matched::Tuple{AbstractMatrix, Tuple{AbstractMatrix, AbstractMatrix}}, ::Any, ::NamedTuple)
@ Lux C:\Users\rathorek\.julia\packages\Lux\5xfGO\src\layers\recurrent.jl:436