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

Defined to_vec for ChainRulesCore differential types #111

Merged
merged 2 commits into from
Oct 13, 2020

Conversation

oxinabox
Copy link
Member

We already had ChainRulesCore as a dependency.
ChainRulesTestUtils was type-piratically defining to_vec on Composite{<:Tuple, <:Tuple}
This PR adds for AbstractZero (useful if working with a deep structure containing some Zero parts).
and it adds for Composite on structs.

Supporting to_vec on Composites of structs will close the last parts of
JuliaDiff/ChainRulesTestUtils.jl#24
which really should have been on this repo.
I don't think it alone is enough to do finite differencing on structs, but it is a first step.

This works without JuliaDiff/ChainRulesCore.jl#230
but for the tests to pass it needs that, since equality was defined wong

Copy link
Contributor

@nickrobinson251 nickrobinson251 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Presuming the test failure is fixed by JuliaDiff/ChainRulesCore.jl#230

src/to_vec.jl Outdated Show resolved Hide resolved
src/to_vec.jl Outdated Show resolved Hide resolved
Copy link
Member

@willtebbutt willtebbutt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Definitely good to have this done.

Update src/to_vec.jl

Co-authored-by: Nick Robinson <[email protected]>

Update src/to_vec.jl
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

Successfully merging this pull request may close these issues.

3 participants