Skip to content
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

infinite recursion when applying f32 on empty layer #2571

Open
CarloLucibello opened this issue Jan 1, 2025 · 0 comments
Open

infinite recursion when applying f32 on empty layer #2571

CarloLucibello opened this issue Jan 1, 2025 · 0 comments
Labels

Comments

@CarloLucibello
Copy link
Member

julia> struct M end

julia> Flux.@layer M

julia> m = M()
M()

julia> fmap(identity, m)
M()

julia> f32(m)
ERROR: StackOverflowError:
Stacktrace:
     [1] fmap(::Function, ::M; exclude::Function, walk::Functors.DefaultWalk, cache::IdDict{Any, Any}, prune::Functors.NoKeyword)
       @ Functors ~/.julia/packages/Functors/LbNAu/src/maps.jl:7
     [2] fmap(::Function, ::M)
       @ Functors ~/.julia/packages/Functors/LbNAu/src/maps.jl:3
     [3] adapt_structure(to::Flux.FluxEltypeAdaptor{Float32}, layer::M)
       @ Main ~/.julia/packages/Flux/Mhg1r/src/layers/macro.jl:102
     [4] adapt(to::Flux.FluxEltypeAdaptor{Float32}, x::M)
       @ Adapt ~/.julia/packages/Adapt/VO8tI/src/Adapt.jl:40
     [5] (::Base.Fix1{typeof(Adapt.adapt), Flux.FluxEltypeAdaptor{Float32}})(y::M)
       @ Base ./operators.jl:1127
     [6] (::Functors.ExcludeWalk{Functors.DefaultWalk, Base.Fix1{…}, typeof(Functors.isleaf)})(::Function, ::M)
       @ Functors ~/.julia/packages/Functors/LbNAu/src/walks.jl:126
     [7] (::Functors.CachedWalk{Functors.ExcludeWalk{…}, Functors.NoKeyword, Functors.WalkCache{…}})(::Function, ::M)
       @ Functors ~/.julia/packages/Functors/LbNAu/src/walks.jl:177
     [8] execute(::Functors.CachedWalk{Functors.ExcludeWalk{…}, Functors.NoKeyword, Functors.WalkCache{…}}, ::M)
       @ Functors ~/.julia/packages/Functors/LbNAu/src/walks.jl:55
     [9] fmap(::Function, ::M; exclude::Function, walk::Functors.DefaultWalk, cache::IdDict{Any, Any}, prune::Functors.NoKeyword)
       @ Functors ~/.julia/packages/Functors/LbNAu/src/maps.jl:11
--- the above 8 lines are repeated 7870 more times ---
 [62970] fmap(::Function, ::M)
       @ Functors ~/.julia/packages/Functors/LbNAu/src/maps.jl:3
 [62971] _paramtype(::Type{Float32}, m::M)
       @ Flux ~/.julia/packages/Flux/Mhg1r/src/functor.jl:127
Some type information was truncated. Use `show(err)` to see complete types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant