Caching system #257
-
Hello, I wanted to know if, as for the Manopt version in matlab, it was possible to save elements calculated in the objective function, gradient function or the hessian function. In order to use prevent us from redudant computations. As for the example given on the Matlab version of manopt: I find myself in the situation where I'm performing certain calculations in the cost function that also appear in the gradient and I'd like to avoid having to recalculate these same terms. Is it possible to do this in Julia's version? I'm having trouble seeing the links between what I want to do and what I can find here https://manoptjl.org/stable/tutorials/CountAndCache/ Best, Ben |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 11 replies
-
Hi, The Caching system in Manopt directly caches arbitary calls in the objective, that is correct, but since we want to keep cost function signatures simple, they are of the form There is a major design difference here between Manopt in Matlab and Manopt.jl. You have two ways
now initialising
if you define a function
and https://manoptjl.org/stable/plans/objective/#Manopt.ManifoldCostGradientObjective Together with a Cache (as you linked) this should work even better (faster) than the Matlab variant, since Matlab only has one storage for Ax if I read correctly and this would have a storage for each point p (in the cache). This is also the variant that for example In very general one could think about extending the Cache to be able to cache anything and not just calls to the objective, but that would require quite some design thoughts (and I already spent the last 3 months designing the Cache in easy-tp-use, easy-to-add and performant), so that is maybe more like a long time feature still. The main challenge there would still be to keep everything modular while accessing a globally shared memory. Hope this helps :) |
Beta Was this translation helpful? Give feedback.
-
I was very curious and hacked a few examples (but be careful it still has typos in there and some math does not render), just now after work. See the extension I wrote at https://manoptjl.org/previews/PR258/tutorials/CountAndCache/#Advanced-Caching-Examples and I would recommend the storage approach in the cache approach after that (for the storage and in the solver) might be not worth it for gradient descent things; but it is also not much worse. |
Beta Was this translation helpful? Give feedback.
-
We tested the updated docs carefully and they are included in the newest version, see https://manoptjl.org/stable/tutorials/CountAndCache/#Advanced-Caching-Examples if you have further questions – feel free to ask (Caching is sometimes a bit tricky for me for example). |
Beta Was this translation helpful? Give feedback.
We tested the updated docs carefully and they are included in the newest version, see
https://manoptjl.org/stable/tutorials/CountAndCache/#Advanced-Caching-Examples
if you have further questions – feel free to ask (Caching is sometimes a bit tricky for me for example).