Closed KlausLeppkes closed 1 year ago
Indeed we do! This is both because we want to provide this functionality and it actually makes the design much simpler.
And we definitely want to include these examples. If you have any suggestions you should feel free to make a pull request either for the main branch or the website (www branch)!
Hi,
I cloned, build and played around with enzyme and I am very happy so far!:) I want to point out that enzyme is not only calculating gradients, but also implements the adjoint semantics (this is great news for me!).
So do you have plans to add examples for the (AD) community?
I don't want to create a pull request yet, so here is my first quick and dirty test (modified the sumAndMul function to become a speelpenning(ish) function with 2 outputs).
put the attached files into $(ENZYME_ROOT)/ad/test, calling $make
results in correct input adjoints for calling dF 3 times with (1,0), (0,1) and (1,1) for the outptut adjoints (d_mul and d_out2).
./output.exe d(output)/darray[0] = 24.000000 d(output)/darray[1] = 12.000000 d(output)/darray[2] = 8.000000 d(output)/darray[3] = 6.000000
d(output)/darray[0] = 48.000000 d(output)/darray[1] = 24.000000 d(output)/darray[2] = 16.000000 d(output)/darray[3] = 12.000000
d(output)/darray[0] = 72.000000 d(output)/darray[1] = 36.000000 d(output)/darray[2] = 24.000000 d(output)/darray[3] = 18.000000
Very nice! first_example.zip