forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
Hello!
Sorry for the very generic title. I did some tests regarding differentiating a bit more complex function (similar to what my real-world use case would be) than the last time I had a chance to play around with Enzyme. I put everything into a small repo with different cases and the issues that I encountered. Let me know if you want to have them in separate GH issues.
In essence, I have a function with this signature: a(p: &Parameters, t: f64, v: f64, n: &[f64]) -> f64
and I want to compute derivatives w.r.t t
, v
, and n
for given constant p
.
- case1: forward AD w.r.t. to one scalar input works. But when I add another computation, suddenly the formerly correct forward AD now yields a different (wrong) result. I have no idea what's going on here. Along the way there were some issues with (I guess?) allocations inside the function that caused some trouble (commented in the file).
- case2: Copied a working example from case1 into a new file and it stops working. Had to switch from using
Vec
s (orndarray::ArrayBase
) internally to slices to make it work. No idea why it worked incase1
. - case4: Reverse AD does not work when I have my
f64
s marked asActive
and my&[f64]
marked asDuplicated
. Wrapping the function with a function that takes&f64
andDuplicated
for the floats works.
I hope this is somehow helpful. Let me know how I can help to provide more information to find out what's going wrong.
ZuseZ4
Metadata
Metadata
Assignees
Labels
No labels