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 derivatives of randn() #1902

Closed
Jinyu95 opened this issue Sep 27, 2024 · 1 comment
Closed

Incorrect derivatives of randn() #1902

Jinyu95 opened this issue Sep 27, 2024 · 1 comment

Comments

@Jinyu95
Copy link

Jinyu95 commented Sep 27, 2024

Hello, I am using Enzyme 0.13.3 on Julia 1.10.4. When I try to calculate with the randn() function, some of the derivatives become NaN, which never happened when I was using the old version of Enzyme, e.g., 0.12.12.

using Enzyme, Random
function f(L)
    Pts = randn(1000)
    return Pts * L
end

g = autodiff(ForwardWithPrimal, f, Duplicated(1.0, 1.0))

The results are,
(var"1" = [-1.291503755343439, 1.338538415903224, -0.8453583823362729, 0.22304028858797614, NaN, 0.07499515167553646, 1.3437396172304426, 1.030860320072257, NaN, 0.009625274141182433 … NaN, 0.0015532653551571462, NaN, 0.8239779015560049, -0.8827069305850216, -0.8040953683939528, NaN, 0.40769081041334093, NaN, -0.4926716859105508], var"2" = [-1.291503755343439, 1.338538415903224, -0.8453583823362729, 0.22304028858797614, 0.21742228694385105, 0.07499515167553646, 1.3437396172304426, 1.030860320072257, 0.8129765853808152, 0.009625274141182433 … -1.2329602926216028, 0.0015532653551571462, -0.5951276129217884, 0.8239779015560049, -0.8827069305850216, -0.8040953683939528, 1.723594446839804, 0.40769081041334093, -0.8332815626433686, -0.4926716859105508])

@wsmoses
Copy link
Member

wsmoses commented Sep 28, 2024

Fixed by #1906

@wsmoses wsmoses closed this as completed Sep 28, 2024
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

No branches or pull requests

2 participants