RNN weights definition in Flux

In the Flux source files there is a line.

@functor RNNCell

How does the functor understand that state0 and \sigma (which should be fixed) in RNNCell definition aren’t weights?

It doesn’t. The state field is excluded by https://github.com/FluxML/Flux.jl/blob/b7df765301e6fc00b582112daf58916bb6728c24/src/layers/recurrent.jl#L65, which Flux.params calls under the hood.