Add a test mode for forward-on-reverse#796
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
OK, so I have the tests for the x's passing, which I think is correct and not testing that |
Signed-off-by: Hong Ge <3279477+yebai@users.noreply.github.com>
|
@sunxd3, can you help review this? |
| ẏ_ad = tangent(y_ẏ_rule) | ||
|
|
||
| # now use ẏ_ad as output_tangent for rrule again | ||
| test_rrule_correctness( |
There was a problem hiding this comment.
I'm a little confused by why we're running reverse-mode again here. Would you mind running be through the logic of what's going on here again @kshyatt ?
There was a problem hiding this comment.
I have similar question here. It feels like to me that the forward rule is not tested?
There was a problem hiding this comment.
The idea is to generate the derivatives from the forward pass then use them as the outputs to the reverse pass (to ensure you stay in the correct gauge) -- but it's very possible I did this wrong, I find the whole testing framework very hard to make sense of to be honest
Co-authored-by: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Signed-off-by: Katharine Hyatt <kshyatt@users.noreply.github.com>
Co-authored-by: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Signed-off-by: Katharine Hyatt <kshyatt@users.noreply.github.com>
Co-authored-by: Xianda Sun <5433119+sunxd3@users.noreply.github.com> Signed-off-by: Katharine Hyatt <kshyatt@users.noreply.github.com>
|
Definitely!
…On Tue, Nov 4, 2025 at 10:27 PM Hong Ge ***@***.***> wrote:
*yebai* left a comment (chalk-lab/Mooncake.jl#796)
<#796 (comment)>
@kshyatt <https://github.com/kshyatt>, would you be open to combining
this PR with #833 <#833>?
—
Reply to this email directly, view it on GitHub
<#796 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGKJY7ZCN5FQJ6SVBZZ4ND33EK4ZAVCNFSM6AAAAACID4LDROVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTIOBYGA3TGNJWGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
|
Closed in favour of #808 |
This mode is helpful for testing rules where the choice of gauge for outputs (e.g. for eigenvectors) is meaningful. Finite differences will pick an arbitrary gauge which leads to "false" correctness failures in the rule tests. This PR introduces a new mode that runs the reverse mode first (the output tangent allows a particular choice of gauge), checks it with FD, then uses that to check the forward rule.