Skip to content

More complex test cases #196

@g-bauer

Description

@g-bauer

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 Vecs (or ndarray::ArrayBase) internally to slices to make it work. No idea why it worked in case1.
  • case4: Reverse AD does not work when I have my f64s marked as Active and my &[f64] marked as Duplicated. Wrapping the function with a function that takes &f64 and Duplicated 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions