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

Incorrect forward mode gradient for truncated normal distribution #1998

Open
mhauru opened this issue Oct 22, 2024 · 2 comments
Open

Incorrect forward mode gradient for truncated normal distribution #1998

mhauru opened this issue Oct 22, 2024 · 2 comments

Comments

@mhauru
Copy link
Contributor

mhauru commented Oct 22, 2024

MWE:

julia> import FiniteDifferences, Enzyme; using Distributions

julia> func = (a, b, x) -> logpdf(truncated(Normal(), a, b), x)
#29 (generic function with 1 method)

julia> args = (-0.3, 0.3, 0.1)
(-0.3, 0.3, 0.1)

julia> Enzyme.gradient(Enzyme.Forward, Enzyme.Const(func), args...)
(0.6272640800199636, -2.607264080019964, -1.09)

julia> Enzyme.gradient(Enzyme.Reverse, Enzyme.Const(func), args...)
(1.6172640800199638, -1.617264080019964, -0.1)

julia> FiniteDifferences.grad(FiniteDifferences.central_fdm(4, 1), func, args...)
(1.6172640800151292, -1.6172640800193545, -0.0999999999999462)

On Enzyme v0.13.11.

@wsmoses
Copy link
Member

wsmoses commented Oct 22, 2024

A further reduction of this would be helpful to resolving

@mhauru
Copy link
Contributor Author

mhauru commented Oct 23, 2024

Would like to help, but unfortunately I'm too busy right now to find time to minimise further. Open for grabs for anyone to do it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants