-
-
Notifications
You must be signed in to change notification settings - Fork 16
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
Separate walks out from fmap
and add #39 to fcollect
#43
Conversation
Looks solid. Test fixes aside, perhaps we could wrap up #39 quickly and reuse the logic from that PR in |
Have not read this closely, but if I understand right on first look, it doesn't significantly change the logic of basic case? Am curious whether you see such changes allowing all the weird cases in Optimisers.jl to be better abstracted. Re breaking, I think you're saying that the method (But breaking isn't a huge deal, according to https://juliahub.com/ui/Packages/Functors/lER0H/0.3.0?page=2 only 5 direct deps, although that misses Flux somehow.) |
Thinking about the deprecation cycle for |
Yeah that was the goal here. I wanted to refactor the code as part of logical changes, so I pulled the refactoring out separately. Here the refactor is only a cleaner way of implementing the original logic.
I actually want to move towards I think it should be possible to maintain backwards compatibility and support both modes. We can have the
Part of what makes the walks composable is that
Only in part. The walk function here is a specification for starting at Node A in the tree and recursing into its children. I am thinking about it as a rule. You could certainly replace One thing that already works is writing a walk that holds external information (e.g. |
Re breaking, I marked #39 as being v0.4, although I'm not entirely sure we must. Maybe 0.4 should contain both changes? No great rush for #39. And perhaps it's worth adding the Also, thoughts on whether FluxML/Flux.jl#1932 ought to wait for any changes here? |
This is now in there. I think we can release this and #39 together in 0.4 if that's desired. Otherwise, if you would rather wait for #39, that's fine too.
Not on this, but my next planned change will make |
fb81199
to
f788256
Compare
Okay this now has #39 changes as well. Should be ready for another review. |
This type only exists for backwards compatability and should be directly used. | ||
Attempting to wrap an existing `AbstractWalk` is a no-op (i.e. it is not wrapped). | ||
""" | ||
struct AnonymousWalk{F} <: AbstractWalk |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
struct AnonymousWalk{F} <: AbstractWalk | |
struct AnonymousWalk{F<:AbstractWalk} <: AbstractWalk |
Is there any reason not to constrain these type parameters, at least for now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason this type exists is to wrap F
that isn't a AbstractWalk
but still satisfies the AbstractWalk
interface.
Co-authored-by: Brian Chen <[email protected]>
Okay should be good? |
fmap
fmap
and add #39 to fcollect
This is a non-breaking step towards separating all the keywords out of
fmap
. It was a side-effect of working on #41, so I separated the changes out to be evaluated independently. For #41, I am considering a more significant, but orthogonal, set of changes. Do we like this refactor?Actually, this does seem to be breaking, since thewalk
keyword can no longer be an arbitrary function. I only introducedAbstractWalk
to get around the method ambiguity error forfmap
. Don't see another way around it.