-
-
Notifications
You must be signed in to change notification settings - Fork 157
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DiffEqFlux Layers don't satisfy Lux API #727
Comments
Should be easy initialparameters(rng::AbstractRNG, node::NeuralODE) = initialparameters(rng, node.model)
initialstates(rng::AbstractRNG, node::NeuralODE) = initialstates(rng, node.model)
parameterlength(node::NeuralODE) = parameterlength(node.model)
statelength(node::NeuralODE) = statelength(node.model) To make function setup(rng::AbstractRNG, node::NeuralODE)
return (initialparameters(rng, node), initialstates(rng, node))
end |
Are you supposed to overload |
You just need to define initialparameters(rng::AbstractRNG, node::NeuralODE) = initialparameters(rng, node.model)
initialstates(rng::AbstractRNG, node::NeuralODE) = initialstates(rng, node.model) |
We should put an abstract type on all of the AbstractNeuralDE types and then overload from there. |
For it to work yes. Would it be nicer if the number of parameters could be printed automatically? |
I was assuming |
No even if you are not subtying |
I would appreciate it if you could help me understand two questions:
|
It is meant to satisfy an interface.
|
Highly appreciate the clarification you made. |
Flux doesn't care about the subtyping but Lux does, so we should subtype for Lux and then also make it a functor and we're 👍. |
Copying over from #735. All should be an AbstractExplicitLayer, which means they should do things exactly like Dense. They should have one state, take in a state, and return a state. They should take in a neural network definition and give you back a state from setup. Basically, it should act exactly like Dense does, and be able to perfectly swap in without any other code changes, and if not it's wrong. The only thing that should be different is the constructor for the layer. @Abhishek-1Bhatt let me know if you need me to do the first one. |
Once it gets built, http://lux.csail.mit.edu/previews/PR70/manual/interface should describe the recommended Lux Interface. For DiffEqFlux, everything should really be a subtype of http://lux.csail.mit.edu/stable/api/core/#Lux.AbstractExplicitContainerLayer, and there would be no need to define |
Ahh yes, I had thought about it sometime ago https://julialang.slack.com/archives/C7T968HRU/p1655536943724979?thread_ts=1655535510.205359&cid=C7T968HRU but we didn't discuss it so ended up subtyping to |
Done in #750 |
The DiffEqFlux Layers need to satisfy https://lux.csail.mit.edu/dev/api/core/#Lux.AbstractExplicitLayer else the parameters/states returned from
Lux.setup
be incorrect. As pointed out in slackps.layer_1
should not be an empty NamedTuplehttps://lux.csail.mit.edu/dev/manual/interface/ -- is the most recent manual for the interface
The text was updated successfully, but these errors were encountered: