Closed sathvikbhagavan closed 5 months ago
After investigating, this is happening because -
julia> @named input = RealInput(nin = 1)
Model input with 0 (1) equations
Unknowns (1):
u(t) [defaults to 0.0]: Inner variable in RealInput input
Parameters (0):
julia> @named input = RealInput(nin = 2)
Model input with 0 (2) equations
Unknowns (2):
(u(t))[1] [defaults to 0.0]: Inner variable in RealInput input
(u(t))[2] [defaults to 0.0]: Inner variable in RealInput input
Parameters (0):
with nin = 1
, the unknown is a scalar and not a vector and stateless_apply
expects a vector.
looking at the source code for RealInput
:
@connector function RealInput(; name, nin = 1, u_start = nin > 1 ? zeros(nin) : 0.0)
if nin == 1
@variables u(t)=u_start [
input = true,
description = "Inner variable in RealInput $name"
]
else
@variables u(t)[1:nin]=u_start [
input = true,
description = "Inner variable in RealInput $name"
]
u = collect(u)
end
ODESystem(Equation[], t, [u...], []; name = name)
end
@ChrisRackauckas, does it make sense to have a keyword argument isarray
which we can use such that we can have a array with nin = 1
?
Yes
Describe the bug 🐞
NeuralNetworkBlock errors out if either of the inputs/outputs is 1
Expected behavior
It should not error.
Minimal Reproducible Example 👇
Error & Stacktrace ⚠️