-
-
Notifications
You must be signed in to change notification settings - Fork 615
Closed
Description
From FluxML/Optimisers.jl#49 (comment), this isn't great:
julia> fmap(identity, Chain(x=sin, y=cos))
Chain(sin, cos)
The culprit is this functor
method, which could be extended to deal with this.
Line 44 in fe803a1
functor(::Type{<:Chain}, c) = c.layers, ls -> Chain(ls...) |
Or we could delete it, and let Chain be more like Parallel:
julia> Flux.functor(Chain(x=sin, y=cos))
((x = sin, y = cos), Flux.var"#154#155"())
julia> Flux.functor(Parallel(vcat, (x=sin, y=cos)))
((connection = vcat, layers = (x = sin, y = cos)), Flux.var"#178#179"())
Then we would want delete the inner constructor for Chain, so that it accepts a tuple, Chain((sin, cos)) == Chain(sin, cos)
. That would line up with #1809 allowing Chain([sin, cos])
as a type-unstable variant.
Metadata
Metadata
Assignees
Labels
No labels