LuxDL / Lux.jl

Elegant & Performant Scientific Machine Learning in Julia
https://lux.csail.mit.edu/
MIT License
475 stars 57 forks source link

Allow "const" arrays as inputs to `@compact` #588

Closed avik-pal closed 1 month ago

avik-pal commented 4 months ago

Currently if we see an array as a kwarg to @compact we put it in trainable mode.

But consider an UDE as a motivating example:

@compact(; model, p_true) do x, p
    dudt(u, p, t) = <nn part> .+ <use p_true>
    ...
end

We could in-principle construct the model and then use freeze, but freeze is known to not work well with non-NamedTuple inputs so it becomes a problem for sciml use cases.

Proposed solution(s):