Skip to content

Error inside Tangent constructor if incorrect backing type is used#495

Merged
mzgubic merged 8 commits into
mainfrom
mz/error
Oct 19, 2021
Merged

Error inside Tangent constructor if incorrect backing type is used#495
mzgubic merged 8 commits into
mainfrom
mz/error

Conversation

@mzgubic

@mzgubic mzgubic commented Oct 19, 2021

Copy link
Copy Markdown
Member

Closes #494. Might need to fix things downstream if incorrect types are used.

Comment thread src/tangent_types/tangent.jl Outdated
Comment thread test/tangent_types/tangent.jl Outdated
Comment thread test/tangent_types/tangent.jl Outdated
Comment thread test/tangent_types/tangent.jl Outdated
Comment thread test/tangent_types/tangent.jl Outdated
Comment thread test/tangent_types/tangent.jl Outdated
Comment thread src/tangent_types/tangent.jl Outdated
Comment thread src/tangent_types/tangent.jl Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@oxinabox

oxinabox commented Oct 19, 2021

Copy link
Copy Markdown
Member

address my comments as you will, and make sure CI is passing.
then merge when happy

Comment thread src/tangent_types/tangent.jl Outdated
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@mzgubic

mzgubic commented Oct 19, 2021

Copy link
Copy Markdown
Member Author

Hmm, actually - what should we do about Any primal type? My initial thought was that it should be a Tuple (since there are no names), but we could allow Tuple, NamedTuple, or Dict?

@oxinabox

Copy link
Copy Markdown
Member

Hmm, actually - what should we do about Any primal type? My initial thought was that it should be a Tuple (since there are no names), but we could allow Tuple, NamedTuple, or Dict?

Yes.
Or even allowing utterly anything.
It's basically just used as a hack in Zygote, but let's not break that hack.

@codecov-commenter

codecov-commenter commented Oct 19, 2021

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.90%. Comparing base (bde3166) to head (d1a9f5b).
⚠️ Report is 266 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #495      +/-   ##
==========================================
- Coverage   92.94%   92.90%   -0.04%     
==========================================
  Files          15       15              
  Lines         822      818       -4     
==========================================
- Hits          764      760       -4     
  Misses         58       58              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@mzgubic

mzgubic commented Oct 19, 2021

Copy link
Copy Markdown
Member Author

Diffractor (same failure on its master) and Julia nightly (test unexpectedly passes) errors look unrelated. Will merge if ChainRules tests pass

Comment thread src/tangent_types/tangent.jl Outdated
Comment thread test/tangent_types/tangent.jl
Co-authored-by: Lyndon White <oxinabox@ucc.asn.au>
@simeonschaub

Copy link
Copy Markdown
Member

This broke Diffractor. Is this really worth it?

@mcabbott

Copy link
Copy Markdown
Member

It could be written out using dispatch instead of if statements, maybe that would help?

@simeonschaub

Copy link
Copy Markdown
Member

No, that's not the problem. Diffractor uses tuple backing for tangents of tangents over tuples. This could probably be changed at some point, but I don't think this should have been merged without any discussion now that we have the integration test.

@oxinabox

Copy link
Copy Markdown
Member

No, that's not the problem. Diffractor uses tuple backing for tangents of tangents over tuples.

Hmm I am not sure that it should.

But for now maybe let's revert this PR, and then we can think about it.

I don't think this should have been merged without any discussion now that we have the integration test.

Ah sorry, I think we just got used to Diffractor being broken.
But it works now that it's CI is set to use Julia nightly.

Yes, this was bad.

@simeonschaub

simeonschaub commented Oct 28, 2021

Copy link
Copy Markdown
Member

Just for the future: Could you please always squash merge commits like these before merging? It's just such a pain to revert otherwise. (Edit: Turns out it's not that bad if you are working off the correct branch 🤦. Squash merges are still pretty much always easier to work with though, so my point still stands.) I wonder whether we should just disallow anything except squash merge for this repo.

simeonschaub added a commit that referenced this pull request Oct 28, 2021
This reverts commit a724bbb, reversing
changes made to bde3166.
@simeonschaub simeonschaub mentioned this pull request Oct 28, 2021
@mzgubic

mzgubic commented Oct 28, 2021

Copy link
Copy Markdown
Member Author

Hey Simeon, sorry about breaking Diffractor. The error looked unrelated and was the same one as on master at the time, so I didn't think there was anything wrong with the PR. And yes, will make sure to merge next time.

No, that's not the problem. Diffractor uses tuple backing for tangents of tangents over tuples.

Are there any reasons why a NamedTuple, e.g. Tangent{Tangent}(; backing=(1, 2, 3)) would not work? I think that would be the most consistent thing to do, unless there are good reasons to just use a Tuple?

@simeonschaub

Copy link
Copy Markdown
Member

Are there any reasons why a NamedTuple, e.g. Tangent{Tangent}(; backing=(1, 2, 3)) would not work?

I'm pretty sure that's possible, but it's not super trivial because that assumption is used in multiple places. Once I have figured that out, we should be able to relate this.

@mcabbott

Copy link
Copy Markdown
Member

This is JuliaDiff/Diffractor.jl#67, BTW.

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.

Should we restrict the types that Tangent can be backed by?

5 participants