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

Fix @test_broken problems #546

Merged
merged 4 commits into from
Feb 6, 2024
Merged

Fix @test_broken problems #546

merged 4 commits into from
Feb 6, 2024

Conversation

simsurace
Copy link
Member

Fixes part of #526

@simsurace simsurace mentioned this pull request Feb 6, 2024
5 tasks
@devmotion
Copy link
Member

There are more bugs regarding @test_broken such as

@test_broken ga = gradient(AD, A) do a
: @test_broken should only applied to expressions that evaluate to a Bool (which in the broken case is false but true if the problem is fixed).

Copy link

codecov bot commented Feb 6, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (e5696d7) 67.00% compared to head (6412453) 0.44%.
Report is 1 commits behind head on master.

❗ Current head 6412453 differs from pull request most recent head 50de544. Consider uploading reports for the commit 50de544 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #546       +/-   ##
==========================================
- Coverage   67.00%   0.44%   -66.56%     
==========================================
  Files          52      52               
  Lines        1373    1342       -31     
==========================================
- Hits          920       6      -914     
- Misses        453    1336      +883     

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

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.

This is great. Please merge if you're happy.

@simsurace
Copy link
Member Author

There are more bugs regarding @test_broken such as

@test_broken ga = gradient(AD, A) do a

: @test_broken should only applied to expressions that evaluate to a Bool (which in the broken case is false but true if the problem is fixed).

I see. Why don't they show up as errors though?
What is the test supposed to do anyway? It is just evaluating a gradient and assigning it to ga. What is broken about this?

@devmotion
Copy link
Member

Probably it throws an error currently which is handled by @test_broken as well. So that case is currently fine - but it's still wrong since the tests will error as soon as the gradient computation does not throw an error anymore. See https://discourse.julialang.org/t/psa-when-tests-fail-due-to-improvements-in-type-inference/102001

@simsurace
Copy link
Member Author

Would it be reasonable to replace these by an approximate equality comparing the chosen AD backend to :FiniteDiff?

@devmotion
Copy link
Member

I guess these are the intended tests:

gx = gradient(AD, X) do x
testfunction(tx_row, x, 2)
end
ga = gradient(AD, A) do a
testfunction(ta_row, a, 2)
end
@test gx ga
So for the ReverseDiff we could just not create the intermediate variables and directly @test_broken the approximate equality of the two gradients?

@simsurace
Copy link
Member Author

This should do it.

@simsurace simsurace merged commit 3b7a2df into master Feb 6, 2024
3 of 4 checks passed
@simsurace simsurace deleted the fix-CI branch February 6, 2024 22:35
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