-
Notifications
You must be signed in to change notification settings - Fork 62
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
Factor out backing and construct into a separate lightweight package? #668
Comments
I don't particularly see a pressing need to remove this duplication. If there was such a need, I would lean towards depending on ConstructionBase. |
With less duplication, more people might be encouraged to specialize these for their types (e.g. types with cache fields, etc.).
Oh, I didn't realize that. I have been using it in more complex pullbacks - what's the recommended way to get at the "contents" of a tangent? |
There isn't one. I also have been using it in more complex tangents. |
I've been using it a few times where I need to deal with or forward the "contents" of a tangent in a generic fashion, like here https://github.com/oschulz/ForwardDiffPullbacks.jl/blob/2ef833bc63886a4be4904e18f49066847c022edd/src/fwd_back.jl#L42 and here https://github.com/oschulz/ValueShapes.jl/blob/ca3b61eabec20445ea0798df3d50a148584e216e/src/named_tuple_shape.jl#L449 and in some testing code. I guess custom code for doing math with tangents will be hard(er) to write without it, too. In general it makes sense to me to have a function to get the "undecorated" contents of tangents. |
For that use case you can use |
Thanks, I'll give that a try. |
We have duplicate implementations of what
backing
andconstruct
do scattered all over the ecosystem, explicitly (e.g. ConstructionBase, Functors, ...) and implicitly in the internals of many packages.The approach and implementation in ChainRulesCore is, to my knowledge, very solid and obviously extensively field-tested. Should we factor this out into a seperate package to make it more directly accessible? ChainRulesCore itself isn't that lightweight a dependency anymore, but a package with just
backing
andconstruct
could be, I think.The text was updated successfully, but these errors were encountered: