niessner / Opt

Opt DSL
Other
256 stars 68 forks source link

Best Practices for energy formulation #119

Open Kalkasas opened 6 years ago

Kalkasas commented 6 years ago

I am currently trying to implement 3D model fitting using a model which uses linear blend skinning. I am running into memory issues because I think the underlying expression graph becomes too big and/or the resulting partial derivatives during symbolic differentiation become too large.

Can you point me to some best practices regarding the ordering of operations to help the underlying code generation process in a better way regarding factoization, substitution...

I implemented my problem on the CPU before using ADOL-C for automatic differentiation and a naive port to Opt does not seem to work. An additional advantage I had there was that I could share computation of subexpressions across some residuals i.e. sharing the kinematic tree computation.

Mx7f commented 6 years ago

This is a problem we have not yet run into, so I do not have much advice. If you provide a test case I could try and reproduce.

Our autodiff implementation is contained in https://github.com/niessner/Opt/blob/master/API/src/ad.t if you prefer to dig in yourself.

The current version of Opt supports subexpression sharing only for unknown-wise residuals (using ComputedArray/ComputedImage). It would be advantageous to extend that.