Closed willtebbutt closed 1 year ago
Base: 68.87% // Head: 93.72% // Increases project coverage by +24.85%
:tada:
Coverage data is based on head (
43748e5
) compared to base (ba7b37c
). Patch coverage: 100.00% of modified lines in pull request are covered.
:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.
Codecov is taking a little while to update. This is ready for review.
Looks good to me, I just think it would be good to add a test for it that fails on the master branch.
Well I implemented this change to fix a test on master, so is it not sufficient that CI now passes?
Summary
We've been seeing test failures for AD with the
MaternKernel
. This fixes these.Proposed changes
Modifies the implementation of the
kappa
function for theMaternKernel
to utiliseif ... else ... end
instead ofifelse.
The reason that this fixes the problem is that, ifiszero(d)
, the branch which calls the bessel function etc (rather that the one that just returns1
) has someNaN
s and someInf
s floating around in it. Theifelse
branch evaluates this branch-with-NaN
s, and when Zygote is performing the reverse pass, thisNaN
somehow gets propagated backwards. Conversely,if ... else ... end
entirely avoids computing anyNaN
s, thereby avoiding the problem.This has the potential downside of yielding worse performance under Zygote, the
MaternKernel
performance was already quite bad, so I don't view this as a problem (it might not even make it much worse tbh).What alternatives have you considered?
The solution that's defnitely going to work + be performant here would be a custom rule, but I don't have the time, and I don't know that this can be improved without sorting out the
besselk
rrule
anyway.Breaking changes
Not breaking.