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

@functor default for GNNLayers #288

Closed
CarloLucibello opened this issue May 25, 2023 · 1 comment
Closed

@functor default for GNNLayers #288

CarloLucibello opened this issue May 25, 2023 · 1 comment
Milestone

Comments

@CarloLucibello
Copy link
Member

Consider adding the definitions

function Functors.functor(::Type{<:GNNLayer}, m::T) where T
    childr = (; (f => getfield(m, f) for f in fieldnames(T))...)
    Tstripped = Base.typename(T).wrapper # remove all parameters. From https://discourse.julialang.org/t/stripping-parameter-from-parametric-types/8293/16
    re = x -> Tstripped(x...)
    return childr, re
end

so that we don't need to add @functor to types inheriting from GNNLayer.

I'm not sure if this change should be considered breaking.

@CarloLucibello CarloLucibello added this to the v1.0 milestone Aug 5, 2024
@CarloLucibello
Copy link
Member Author

CarloLucibello commented Aug 7, 2024

Now that we use Flux.@layer instead (#452) marking every subtype of GNNLayer a @layer by default would be more complicated. We would also lose the customization opportunities (e.g. for show) given by the @layer macro. Since the gain would be very little I think we shouldn't do this.

@CarloLucibello CarloLucibello closed this as not planned Won't fix, can't repro, duplicate, stale Aug 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant