Mikolaj / horde-ad

Higher Order Reverse Derivatives Efficiently - Automatic Differentiation library based on the paper "Provably correct, asymptotically efficient, higher-order reverse-mode automatic differentiation"
BSD 3-Clause "New" or "Revised" License
33 stars 6 forks source link

Add disparity cost volume example #78

Closed benl23x5 closed 1 year ago

Mikolaj commented 1 year ago

Thank you very much for the PR. Is there any interesting way I can apply QuickCheck to this? Either a correctness test or just some non-trivial sanity check, e.g., the dot product of arrDL and arrDR should always be less than something? I suppose comparing derivative vs. difference in output on inputs a tiny bit apart is always an option, but I already do this for other examples, so it's boring.

Mikolaj commented 1 year ago

@benl23x5: any changes you'd like to make before merging?

We are experimenting with vectorizing build in the context of ranked tensors and such tasty nested build as you have here would be very useful to test and benchmark that.

Mikolaj commented 1 year ago

I took the liberty of rebasing and I'm going to merge now. Thank you for the PR!

Mikolaj commented 1 year ago

I've also recast the costVolume code in ranked tensors form and I added tests it:

https://github.com/Mikolaj/horde-ad/blob/51c8504443680dc6f86406e5c146207b80bb5b09/test/simplified/TestConvSimplified.hs#L538-L651

I can't find a closed form for the derivative of costVolume nor any handy properties of its result, so I can't add any QuickCheck tests.