-
Notifications
You must be signed in to change notification settings - Fork 70
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
Unexpected result when function doesn't return nothing #1363
Comments
Enzyme is trying to automatically determine the activity of the return argument. Since you are returning a Float64 the return is set to Active, and an automatic You can set the activity of the return to |
Thanks. Yes, autodiff(Reverse, f1!, Const, Duplicated([0.], [1.]), Duplicated(x, dx1)) gives the expected result. Wouldn't it be better if autodiff(Reverse, f1!, Duplicated([0.], [1.]), Duplicated(x, dx1)) wouldn't exist, such that the user always has to specify, if the return is active or not? |
This is a design decision. The automatic activity deduction makes it easier for folks to use autodiff (e.g. just using on sin), which already gets complaints about it being more difficult than other utilities so I'm hesitant to do so. |
cc @gdalle for design thoughts |
Yeah it's a tough one. Ultimately it's about understanding which adjoints get propagated where. I have wanted to add something like https://discourse.julialang.org/t/do-i-understand-enzyme-properly/97760 to the docs for a while, maybe it would help? |
Yeah I think more docs are definitely needed/helpful |
In any case closing as nothing inside enzyme was erring |
dx2
is the correct result.Is there a way to warn the user. if the function doesn't return
nothing
?This is with Enzyme v0.11.19 and julia 1.10.2.
The text was updated successfully, but these errors were encountered: