-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
basic manifold diff sandbox test #1697
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1697 +/- ##
===========================================
- Coverage 76.48% 54.33% -22.16%
===========================================
Files 74 73 -1
Lines 5601 5595 -6
===========================================
- Hits 4284 3040 -1244
- Misses 1317 2555 +1238
... and 45 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Hi! Thank you, things are going mostly OK. When I was working on finishing ManifoldDiff.jl AD rules it occurred to me that my code is quite far from being polished and well tested. There is a lot of edge cases that are quite difficult to work out. I haven't published some parts yet because I have too few good applications that would show which parts are actually important to polish.
Here are some of conclusions from the work I've done:
I hope this helps. Feel free to ask further questions, there is more that I can share but I don't know what would be interesting for you 🙂 . |
Oh great thanks for the information. Johan and I spoke on a call earlier to work out the best steps to follow in the short term. We would also like to take you up on the offer to call and chat (thanks!) but we want to prepare and do some leg work before we do, so we don't waste your time. We'll work some examples and reach out to you when ready. Two immediate steps for us (scope of 2-3 weeks of work) is to get the IncrementalInference.jl computations onto StaticArrays through all the hot-loops, or as far possible. The next is a stop gap solution to gradients which will be limited to a few GroupManifolds only. We would also need to do (what we call) "partial constraints" -- e.g. a camera sees a feature as i,j pixel coordinate... hence dim2 measurement inside a dim6 SpecialEuclidean(3) mechanization.
Would you perhaps be open to sharing that code snippet? Ultimately we would like to use Manopt with full support for Riemannian operations. We currently use Optim and are considering whether it's worth it to use Optim.manifold as a stop gap while we transition.
Our current best path would be to only do AD on a few specific functions, which get compiled once or AOT. When we build large cost functions, we'd assemble the cost via a for loop. The non-parametric case would leverage the same few AD functions (using different kind of for loop assembly).
Perhaps this is an area where we can help. At this stage we are likely using only a few manifolds relating to 2D and 3D mechanics with a few sensor or derivative variations.
I'd rather write a few specializations needed by Manifolds to avoid allocations or type-stability issues. One of the ideas I'm trying to avoid is building LazyLieGroup types and then defining ChainRules.jl definitions for these new "driven" types. I'd rather stay closer to Manifolds.jl native and just overwrite the three or four functions that really make AD or Manopt run fast -- from there we can upstream the specialized functions to JuliaManifolds (if they help / fit in). |
Sure! I've made a gist here: https://gist.github.com/mateuszbaran/0354c0edfb9cdf25e084a2b915816a09 . It would be good to put it in some package but I'm not sure in which one. I think Optim.Manifold with my glue code is a perfectly fine way of doing Riemannian optimisation. Of course, it has a very limited set of ways of handling Riemannian constraints compared to Manopt.jl but for some problems they are sufficient. It's definitely worth a try if you already use Optim.
I see. If you can write which functions you want to do AD on I may have some more specific thoughts on that.
My current examples are also limited to a few manifolds (hyperbolic space, sphere, tangent bundle) so any new example could help 🙂 . I was exploring Stiefel and Grassmann constraints but there the issue is that it is too easy to derive gradients using with https://www.matrixcalculus.org/ and hand-optimise the code beyond what AD in Julia could do. Or maybe I'm just looking at this from the wrong side and using https://www.matrixcalculus.org/ is actually too complex for some people interested in this kind of thing? Designing good interfaces is hard and usually underappreciated. Anyway, back to the main topic, it would be great to incorporate your needs into this work and have another point of view.
That sounds like a good idea, I can help with that when I know which functions are needed. |
Hi @mateuszbaran,
Hope things are well. I was looking at the new ManifoldDiff and Manopt stuff you put up recently. Thanks for putting that up!
I was wondering if this quick example PR (see files changed tab) was in-line with how you'd recommend we implement?
Best,
Dehann
PS, We'd like to build towards Riemannian optimization even though the current IncrementalInference implementation still has a few remaining AbtractGroupManifold requirements.
PSS, Looks like this basic example has very heavy recompilation load. Will be looking to get down to 0% compile time as most important, then move towards 0 heap allocations from there.